rpc: minor fixes.
This commit is contained in:
parent
c5e4aa0245
commit
cb5fa84042
@ -333,7 +333,7 @@ RPC.prototype.getinfo = co(function* getinfo(args, help) {
|
||||
|
||||
return {
|
||||
version: pkg.version,
|
||||
protocolversion: this.pool.protoVersion,
|
||||
protocolversion: this.pool.options.version,
|
||||
walletversion: 0,
|
||||
balance: Amount.btc(balance.unconfirmed, true),
|
||||
blocks: this.chain.height,
|
||||
@ -384,8 +384,8 @@ RPC.prototype.getnetworkinfo = co(function* getnetworkinfo(args, help) {
|
||||
|
||||
return {
|
||||
version: pkg.version,
|
||||
subversion: this.pool.userAgent,
|
||||
protocolversion: this.pool.protoVersion,
|
||||
subversion: this.pool.options.agent,
|
||||
protocolversion: this.pool.options.version,
|
||||
localservices: this.pool.address.services,
|
||||
timeoffset: this.network.time.offset,
|
||||
connections: this.pool.peers.size(),
|
||||
@ -637,7 +637,7 @@ RPC.prototype._getSoftforks = function _getSoftforks() {
|
||||
RPC.prototype._getBIP9Softforks = co(function* _getBIP9Softforks() {
|
||||
var tip = this.chain.tip;
|
||||
var forks = {};
|
||||
var i, deployment, state;
|
||||
var i, deployment, state, status;
|
||||
|
||||
for (i = 0; i < this.network.deploys.length; i++) {
|
||||
deployment = this.network.deploys[i];
|
||||
@ -645,24 +645,27 @@ RPC.prototype._getBIP9Softforks = co(function* _getBIP9Softforks() {
|
||||
|
||||
switch (state) {
|
||||
case common.thresholdStates.DEFINED:
|
||||
state = 'defined';
|
||||
status = 'defined';
|
||||
break;
|
||||
case common.thresholdStates.STARTED:
|
||||
state = 'started';
|
||||
status = 'started';
|
||||
break;
|
||||
case common.thresholdStates.LOCKED_IN:
|
||||
state = 'locked_in';
|
||||
status = 'locked_in';
|
||||
break;
|
||||
case common.thresholdStates.ACTIVE:
|
||||
state = 'active';
|
||||
status = 'active';
|
||||
break;
|
||||
case common.thresholdStates.FAILED:
|
||||
state = 'failed';
|
||||
status = 'failed';
|
||||
break;
|
||||
default:
|
||||
assert(false, 'Bad state.');
|
||||
break;
|
||||
}
|
||||
|
||||
forks[deployment.name] = {
|
||||
status: state,
|
||||
status: status,
|
||||
bit: deployment.bit,
|
||||
startTime: deployment.startTime,
|
||||
timeout: deployment.timeout
|
||||
@ -690,7 +693,7 @@ RPC.prototype.getblockchaininfo = co(function* getblockchaininfo(args, help) {
|
||||
softforks: this._getSoftforks(),
|
||||
bip9_softforks: yield this._getBIP9Softforks(),
|
||||
pruneheight: this.chain.options.prune
|
||||
? Math.max(0, this.chain.height - this.chain.db.keepBlocks)
|
||||
? Math.max(0, this.chain.height - this.network.block.keepBlocks)
|
||||
: null
|
||||
};
|
||||
});
|
||||
@ -2197,7 +2200,7 @@ RPC.prototype.getrawtransaction = co(function* getrawtransaction(args, help) {
|
||||
verbose = false;
|
||||
|
||||
if (args.length > 1)
|
||||
verbose = Boolean(args[1]);
|
||||
verbose = toBool(args[1]);
|
||||
|
||||
tx = yield this.node.getTX(hash);
|
||||
|
||||
@ -2353,7 +2356,8 @@ RPC.prototype._signrawtransaction = co(function* signrawtransaction(wallet, tx,
|
||||
|
||||
RPC.prototype.fundrawtransaction = co(function* fundrawtransaction(args, help) {
|
||||
var wallet = this.wallet;
|
||||
var tx, options, changeAddress, feeRate;
|
||||
var feeRate = this.feeRate;
|
||||
var tx, options, changeAddress;
|
||||
|
||||
if (help || args.length < 1 || args.length > 2)
|
||||
throw new RPCError('fundrawtransaction "hexstring" ( options )');
|
||||
@ -2843,7 +2847,7 @@ RPC.prototype.encryptwallet = co(function* encryptwallet(args, help) {
|
||||
var wallet = this.wallet;
|
||||
var passphrase;
|
||||
|
||||
if (!wallet.master.encrypted && (help || help !== 1))
|
||||
if (!wallet.master.encrypted && (help || args.length !== 1))
|
||||
throw new RPCError('encryptwallet "passphrase"');
|
||||
|
||||
if (wallet.master.encrypted)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user