bitcoind: camelCase getInfo results

for consistency with other bitcoind api responses
This commit is contained in:
Braydon Fuller 2016-05-11 11:16:04 -04:00
parent 4757edc570
commit d399e9acea
3 changed files with 30 additions and 10 deletions

View File

@ -1724,14 +1724,14 @@ Bitcoin.prototype.getSpentInfo = function(options, callback) {
* This will return information about the database in the format: * This will return information about the database in the format:
* { * {
* version: 110000, * version: 110000,
* protocolversion: 70002, * protocolVersion: 70002,
* blocks: 151, * blocks: 151,
* timeoffset: 0, * timeOffset: 0,
* connections: 0, * connections: 0,
* difficulty: 4.6565423739069247e-10, * difficulty: 4.6565423739069247e-10,
* testnet: false, * testnet: false,
* network: 'testnet' * network: 'testnet'
* relayfee: 1000, * relayFee: 1000,
* errors: '' * errors: ''
* } * }
* @param {Function} callback * @param {Function} callback
@ -1745,14 +1745,14 @@ Bitcoin.prototype.getInfo = function(callback) {
var result = response.result; var result = response.result;
var info = { var info = {
version: result.version, version: result.version,
protocolversion: result.protocolversion, protocolVersion: result.protocolversion,
blocks: result.blocks, blocks: result.blocks,
timeoffset: result.timeoffset, timeOffset: result.timeoffset,
connections: result.connections, connections: result.connections,
proxy: result.proxy, proxy: result.proxy,
difficulty: result.difficulty, difficulty: result.difficulty,
testnet: result.testnet, testnet: result.testnet,
relayfee: result.relayfee, relayFee: result.relayfee,
errors: result.errors, errors: result.errors,
network: self.node.getNetworkName() network: self.node.getNetworkName()
}; };

View File

@ -449,11 +449,11 @@ describe('Bitcoind Functionality', function() {
should.exist(info); should.exist(info);
should.exist(info.version); should.exist(info.version);
should.exist(info.blocks); should.exist(info.blocks);
should.exist(info.timeoffset); should.exist(info.timeOffset);
should.exist(info.connections); should.exist(info.connections);
should.exist(info.difficulty); should.exist(info.difficulty);
should.exist(info.testnet); should.exist(info.testnet);
should.exist(info.relayfee); should.exist(info.relayFee);
should.exist(info.errors); should.exist(info.errors);
done(); done();
}); });

View File

@ -3184,7 +3184,18 @@ describe('Bitcoin Service', function() {
var bitcoind = new BitcoinService(baseConfig); var bitcoind = new BitcoinService(baseConfig);
bitcoind.node.getNetworkName = sinon.stub().returns('testnet'); bitcoind.node.getNetworkName = sinon.stub().returns('testnet');
var getInfo = sinon.stub().callsArgWith(0, null, { var getInfo = sinon.stub().callsArgWith(0, null, {
result: {} result: {
version: 1,
protocolversion: 1,
blocks: 1,
timeoffset: 1,
connections: 1,
proxy: '',
difficulty: 1,
testnet: true,
relayfee: 10,
errors: ''
}
}); });
bitcoind.nodes.push({ bitcoind.nodes.push({
client: { client: {
@ -3196,7 +3207,16 @@ describe('Bitcoin Service', function() {
return done(err); return done(err);
} }
should.exist(info); should.exist(info);
should.exist(info.network); should.equal(info.version, 1);
should.equal(info.protocolVersion, 1);
should.equal(info.blocks, 1);
should.equal(info.timeOffset, 1);
should.equal(info.connections, 1);
should.equal(info.proxy, '');
should.equal(info.difficulty, 1);
should.equal(info.testnet, true);
should.equal(info.relayFee, 10);
should.equal(info.errors, '');
info.network.should.equal('testnet'); info.network.should.equal('testnet');
done(); done();
}); });