This commit is contained in:
Christopher Jeffrey 2016-04-01 15:34:40 -07:00
parent 90aa2d81a6
commit d83a68523e

View File

@ -460,6 +460,21 @@ NodeServer.prototype._init = function _init() {
});
});
// Mempool snapshot
this.get('/mempool', function(req, res, next, send) {
self.node.mempool.getAll(function(err, txs) {
if (err)
return callback(err);
if (!txs.length)
return send(404);
send(200, txs.map(function(tx) {
return tx.toJSON();
}));
});
});
this.server.on('error', function(err) {
self.emit('error', err);
});