rpc: minor fixes.
This commit is contained in:
parent
eef018004f
commit
c1d6896797
@ -834,7 +834,7 @@ RPC.prototype._scriptToJSON = function scriptToJSON(script, hex) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
RPC.prototype.getblockhash = co(function* getblockhash(args) {
|
RPC.prototype.getblockhash = co(function* getblockhash(args) {
|
||||||
var height, entry;
|
var height, hash;
|
||||||
|
|
||||||
if (args.help || args.length !== 1)
|
if (args.help || args.length !== 1)
|
||||||
throw new RPCError('getblockhash index');
|
throw new RPCError('getblockhash index');
|
||||||
@ -844,12 +844,12 @@ RPC.prototype.getblockhash = co(function* getblockhash(args) {
|
|||||||
if (height < 0 || height > this.chain.height)
|
if (height < 0 || height > this.chain.height)
|
||||||
throw new RPCError('Block height out of range.');
|
throw new RPCError('Block height out of range.');
|
||||||
|
|
||||||
entry = yield this.chain.db.getEntry(height);
|
hash = yield this.chain.db.getHash(height);
|
||||||
|
|
||||||
if (!entry)
|
if (!hash)
|
||||||
throw new RPCError('Not found.');
|
throw new RPCError('Not found.');
|
||||||
|
|
||||||
return entry.rhash();
|
return util.revHex(hash);
|
||||||
});
|
});
|
||||||
|
|
||||||
RPC.prototype.getblockheader = co(function* getblockheader(args) {
|
RPC.prototype.getblockheader = co(function* getblockheader(args) {
|
||||||
@ -2418,7 +2418,7 @@ RPC.prototype.validateaddress = co(function* validateaddress(args) {
|
|||||||
json = {
|
json = {
|
||||||
isvalid: true,
|
isvalid: true,
|
||||||
address: address.toBase58(this.network),
|
address: address.toBase58(this.network),
|
||||||
scriptPubKey: address.toScript().toJSON(),
|
scriptPubKey: Script.fromAddress(address).toJSON(),
|
||||||
ismine: path ? true : false,
|
ismine: path ? true : false,
|
||||||
iswatchonly: path ? wallet.watchOnly : false
|
iswatchonly: path ? wallet.watchOnly : false
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user