server. one hash.

This commit is contained in:
Christopher Jeffrey 2016-04-17 22:26:11 -07:00
parent 6fc3c15c77
commit 1ea23577e4
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 83 additions and 25 deletions

View File

@ -239,7 +239,12 @@ HTTPServer.prototype._init = function _init() {
if (!tx) if (!tx)
return send(404); 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) if (!txs.length)
return send(404); return send(404);
send(200, txs.map(function(tx) { utils.forEach(txs, function(tx, next) {
return tx.toJSON(); 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) if (!txs.length)
return send(404); return send(404);
send(200, txs.map(function(tx) { utils.forEach(txs, function(tx, next) {
return tx.toJSON(); 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) if (!txs.length)
return send(404); return send(404);
send(200, txs.map(function(tx) { utils.forEach(txs, function(tx, next) {
return tx.toJSON(); 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) if (!txs.length)
return send(404); return send(404);
send(200, txs.map(function(tx) { utils.forEach(txs, function(tx, next) {
return tx.toJSON(); 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) if (!txs.length)
return send(404); return send(404);
send(200, txs.map(function(tx) { utils.forEach(txs, function(tx, next) {
return tx.toJSON(); 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) if (!txs.length)
return send(404); return send(404);
send(200, txs.map(function(tx) { utils.forEach(txs, function(tx, next) {
return tx.toJSON(); 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) if (!tx)
return send(404); 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) { this.get('/mempool', function(req, res, next, send) {
self.node.mempool.getHistory(function(err, txs) { self.node.mempool.getHistory(function(err, txs) {
if (err) if (err)
return callback(err); return next(err);
if (!txs.length) if (!txs.length)
return send(404); return send(404);
send(200, txs.map(function(tx) { utils.forEach(txs, function(tx, next) {
return tx.toJSON(); self.node.fillHistory(tx, next);
})); }, function(err) {
if (err)
return next(err);
send(200, txs.map(function(tx) {
return tx.toJSON();
}));
});
}); });
}); });

View File

@ -558,7 +558,7 @@ exports.sequence = {
*/ */
exports.ONE_HASH = new Buffer( exports.ONE_HASH = new Buffer(
'0000000000000000000000000000000000000000000000000000000000000001', '0100000000000000000000000000000000000000000000000000000000000000',
'hex' 'hex'
); );