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) {
|
RPC.prototype.listsinceblock = function listsinceblock(args, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var block, conf, out;
|
var block, conf, out, highest;
|
||||||
|
|
||||||
if (args.help) {
|
if (args.help) {
|
||||||
return callback(new Error('listsinceblock'
|
return callback(new Error('listsinceblock'
|
||||||
@ -2620,6 +2620,8 @@ RPC.prototype.listsinceblock = function listsinceblock(args, callback) {
|
|||||||
block = utils.revHex(block);
|
block = utils.revHex(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
conf = 0;
|
||||||
|
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
conf = Number(args[1]);
|
conf = Number(args[1]);
|
||||||
if (!utils.isNumber(conf) || conf < 0)
|
if (!utils.isNumber(conf) || conf < 0)
|
||||||
@ -2642,6 +2644,13 @@ RPC.prototype.listsinceblock = function listsinceblock(args, callback) {
|
|||||||
utils.forEachSerial(txs, function(tx, next, i) {
|
utils.forEachSerial(txs, function(tx, next, i) {
|
||||||
if (tx.height < height)
|
if (tx.height < height)
|
||||||
return next();
|
return next();
|
||||||
|
|
||||||
|
if (tx.getConfirmations() < conf)
|
||||||
|
return next();
|
||||||
|
|
||||||
|
if (!highest || tx.height > highest)
|
||||||
|
highest = tx;
|
||||||
|
|
||||||
self._toListTX(tx, function(err, json) {
|
self._toListTX(tx, function(err, json) {
|
||||||
if (err)
|
if (err)
|
||||||
return next(err);
|
return next(err);
|
||||||
@ -2651,7 +2660,13 @@ RPC.prototype.listsinceblock = function listsinceblock(args, callback) {
|
|||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (err)
|
if (err)
|
||||||
return callback(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