tx.time defaults to now
This commit is contained in:
parent
e6956d6830
commit
52a2ae6047
|
@ -952,6 +952,7 @@ WalletService.prototype.getTxHistory = function(opts, cb) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var now = Math.floor(Date.now() / 1000);
|
||||||
|
|
||||||
return _.map(txs, function(tx) {
|
return _.map(txs, function(tx) {
|
||||||
var inputs = classify(tx.inputs);
|
var inputs = classify(tx.inputs);
|
||||||
|
@ -979,7 +980,7 @@ WalletService.prototype.getTxHistory = function(opts, cb) {
|
||||||
action: action,
|
action: action,
|
||||||
amount: amount,
|
amount: amount,
|
||||||
fees: tx.fees,
|
fees: tx.fees,
|
||||||
time: tx.time,
|
time: tx.time || now,
|
||||||
addressTo: addressTo,
|
addressTo: addressTo,
|
||||||
confirmations: tx.confirmations,
|
confirmations: tx.confirmations,
|
||||||
};
|
};
|
||||||
|
@ -1003,7 +1004,6 @@ WalletService.prototype.getTxHistory = function(opts, cb) {
|
||||||
|
|
||||||
function paginate(txs) {
|
function paginate(txs) {
|
||||||
var limited = opts.limit && opts.limit != -1;
|
var limited = opts.limit && opts.limit != -1;
|
||||||
if (!opts.minTs && !opts.maxTs && !limited) return;
|
|
||||||
var minTs = opts.minTs || 0;
|
var minTs = opts.minTs || 0;
|
||||||
var maxTs = opts.maxTs || Math.ceil(Date.now() / 1000);
|
var maxTs = opts.maxTs || Math.ceil(Date.now() / 1000);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue