coin: better json.

This commit is contained in:
Christopher Jeffrey 2016-10-24 16:35:19 -07:00
parent 9dcd366d15
commit d8006cb9df
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 7 additions and 1 deletions

View File

@ -165,11 +165,17 @@ Coin.prototype.inspect = function inspect() {
*/
Coin.prototype.toJSON = function toJSON() {
var address = this.getAddress();
if (address)
address = address.toBase58();
return {
version: this.version,
height: this.height,
value: utils.btc(this.value),
script: this.script.toJSON(),
address: address,
coinbase: this.coinbase,
hash: this.hash ? utils.revHex(this.hash) : null,
index: this.index

View File

@ -1850,7 +1850,7 @@ WalletDB.prototype._removeBlock = co(function* removeBlock(entry) {
yield this.setTip(prev);
this.logger.warning('Disconnected block %s (tx=%d).',
utils.revHex(block.hash), block.txs.length);
utils.revHex(tip.hash), block.txs.length);
return block.txs.length;
});