rpc: minor fixes.

This commit is contained in:
Christopher Jeffrey 2016-12-14 04:20:05 -08:00
parent eef018004f
commit c1d6896797
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -834,7 +834,7 @@ RPC.prototype._scriptToJSON = function scriptToJSON(script, hex) {
};
RPC.prototype.getblockhash = co(function* getblockhash(args) {
var height, entry;
var height, hash;
if (args.help || args.length !== 1)
throw new RPCError('getblockhash index');
@ -844,12 +844,12 @@ RPC.prototype.getblockhash = co(function* getblockhash(args) {
if (height < 0 || height > this.chain.height)
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.');
return entry.rhash();
return util.revHex(hash);
});
RPC.prototype.getblockheader = co(function* getblockheader(args) {
@ -2418,7 +2418,7 @@ RPC.prototype.validateaddress = co(function* validateaddress(args) {
json = {
isvalid: true,
address: address.toBase58(this.network),
scriptPubKey: address.toScript().toJSON(),
scriptPubKey: Script.fromAddress(address).toJSON(),
ismine: path ? true : false,
iswatchonly: path ? wallet.watchOnly : false
};