From c1d6896797780ae4434dfb205035e0abea224b4a Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 14 Dec 2016 04:20:05 -0800 Subject: [PATCH] rpc: minor fixes. --- lib/http/rpc.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/http/rpc.js b/lib/http/rpc.js index a19b0e09..2d42a0ca 100644 --- a/lib/http/rpc.js +++ b/lib/http/rpc.js @@ -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 };