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 };