diff --git a/lib/bcoin/http/server.js b/lib/bcoin/http/server.js index 529ace10..b4578070 100644 --- a/lib/bcoin/http/server.js +++ b/lib/bcoin/http/server.js @@ -239,7 +239,12 @@ HTTPServer.prototype._init = function _init() { if (!tx) return send(404); - send(200, tx.toJSON()); + self.node.fillHistory(tx, function(err) { + if (err) + return next(err); + + send(200, tx.toJSON()); + }); }); }); @@ -252,9 +257,16 @@ HTTPServer.prototype._init = function _init() { if (!txs.length) return send(404); - send(200, txs.map(function(tx) { - return tx.toJSON(); - })); + utils.forEach(txs, function(tx, next) { + self.node.fillHistory(tx, next); + }, function(err) { + if (err) + return next(err); + + send(200, txs.map(function(tx) { + return tx.toJSON(); + })); + }); }); }); @@ -267,9 +279,16 @@ HTTPServer.prototype._init = function _init() { if (!txs.length) return send(404); - send(200, txs.map(function(tx) { - return tx.toJSON(); - })); + utils.forEach(txs, function(tx, next) { + self.node.fillHistory(tx, next); + }, function(err) { + if (err) + return next(err); + + send(200, txs.map(function(tx) { + return tx.toJSON(); + })); + }); }); }); @@ -463,9 +482,16 @@ HTTPServer.prototype._init = function _init() { if (!txs.length) return send(404); - send(200, txs.map(function(tx) { - return tx.toJSON(); - })); + utils.forEach(txs, function(tx, next) { + self.walletdb.fillHistory(tx, next); + }, function(err) { + if (err) + return next(err); + + send(200, txs.map(function(tx) { + return tx.toJSON(); + })); + }); }); }); @@ -478,9 +504,16 @@ HTTPServer.prototype._init = function _init() { if (!txs.length) return send(404); - send(200, txs.map(function(tx) { - return tx.toJSON(); - })); + utils.forEach(txs, function(tx, next) { + self.walletdb.fillHistory(tx, next); + }, function(err) { + if (err) + return next(err); + + send(200, txs.map(function(tx) { + return tx.toJSON(); + })); + }); }); }); @@ -493,9 +526,16 @@ HTTPServer.prototype._init = function _init() { if (!txs.length) return send(404); - send(200, txs.map(function(tx) { - return tx.toJSON(); - })); + utils.forEach(txs, function(tx, next) { + self.walletdb.fillHistory(tx, next); + }, function(err) { + if (err) + return next(err); + + send(200, txs.map(function(tx) { + return tx.toJSON(); + })); + }); }); }); @@ -510,9 +550,16 @@ HTTPServer.prototype._init = function _init() { if (!txs.length) return send(404); - send(200, txs.map(function(tx) { - return tx.toJSON(); - })); + utils.forEach(txs, function(tx, next) { + self.walletdb.fillHistory(tx, next); + }, function(err) { + if (err) + return next(err); + + send(200, txs.map(function(tx) { + return tx.toJSON(); + })); + }); }); }); @@ -525,7 +572,11 @@ HTTPServer.prototype._init = function _init() { if (!tx) return send(404); - send(200, tx.toJSON()); + self.walletdb.fillHistory(tx, function(err) { + if (err) + return next(err); + send(200, tx.toJSON()); + }); }); }); @@ -545,14 +596,21 @@ HTTPServer.prototype._init = function _init() { this.get('/mempool', function(req, res, next, send) { self.node.mempool.getHistory(function(err, txs) { if (err) - return callback(err); + return next(err); if (!txs.length) return send(404); - send(200, txs.map(function(tx) { - return tx.toJSON(); - })); + utils.forEach(txs, function(tx, next) { + self.node.fillHistory(tx, next); + }, function(err) { + if (err) + return next(err); + + send(200, txs.map(function(tx) { + return tx.toJSON(); + })); + }); }); }); diff --git a/lib/bcoin/protocol/constants.js b/lib/bcoin/protocol/constants.js index 73ba1d41..7f3c47c5 100644 --- a/lib/bcoin/protocol/constants.js +++ b/lib/bcoin/protocol/constants.js @@ -558,7 +558,7 @@ exports.sequence = { */ exports.ONE_HASH = new Buffer( - '0000000000000000000000000000000000000000000000000000000000000001', + '0100000000000000000000000000000000000000000000000000000000000000', 'hex' );