rpc: listsinceblock.
This commit is contained in:
parent
d32df008df
commit
3406a09cd5
@ -2606,7 +2606,7 @@ RPC.prototype.listreceivedbyaddress = function listreceivedbyaddress(args, callb
|
||||
|
||||
RPC.prototype.listsinceblock = function listsinceblock(args, callback) {
|
||||
var self = this;
|
||||
var block, conf, out;
|
||||
var block, conf, out, highest;
|
||||
|
||||
if (args.help) {
|
||||
return callback(new Error('listsinceblock'
|
||||
@ -2620,6 +2620,8 @@ RPC.prototype.listsinceblock = function listsinceblock(args, callback) {
|
||||
block = utils.revHex(block);
|
||||
}
|
||||
|
||||
conf = 0;
|
||||
|
||||
if (args.length > 1) {
|
||||
conf = Number(args[1]);
|
||||
if (!utils.isNumber(conf) || conf < 0)
|
||||
@ -2642,6 +2644,13 @@ RPC.prototype.listsinceblock = function listsinceblock(args, callback) {
|
||||
utils.forEachSerial(txs, function(tx, next, i) {
|
||||
if (tx.height < height)
|
||||
return next();
|
||||
|
||||
if (tx.getConfirmations() < conf)
|
||||
return next();
|
||||
|
||||
if (!highest || tx.height > highest)
|
||||
highest = tx;
|
||||
|
||||
self._toListTX(tx, function(err, json) {
|
||||
if (err)
|
||||
return next(err);
|
||||
@ -2651,7 +2660,13 @@ RPC.prototype.listsinceblock = function listsinceblock(args, callback) {
|
||||
}, function(err) {
|
||||
if (err)
|
||||
return callback(err);
|
||||
callback(null, out);
|
||||
|
||||
callback(null, {
|
||||
transactions: out,
|
||||
lastblock: highest && highest.block
|
||||
? utils.revHex(highest.block)
|
||||
: constants.NULL_HASH
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user