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