diff --git a/lib/server.js b/lib/server.js index 7501019..1fc2d56 100644 --- a/lib/server.js +++ b/lib/server.js @@ -1457,7 +1457,7 @@ WalletService.prototype.getTxHistory = function(opts, cb) { action: action, amount: amount, fees: tx.fees, - time: tx.time || now, + time: tx.firstSeenTs || tx.time || now, addressTo: addressTo, confirmations: tx.confirmations, }; diff --git a/test/integration/server.js b/test/integration/server.js index 8d14f2c..d3ea502 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -3363,7 +3363,8 @@ describe('Wallet service', function() { txid: '1', confirmations: 1, fees: 100, - time: 1, + time: 20, + firstSeenTs: 2, inputs: [{ address: 'external', amount: 500, @@ -3382,6 +3383,7 @@ describe('Wallet service', function() { tx.action.should.equal('received'); tx.amount.should.equal(200); tx.fees.should.equal(100); + tx.time.should.equal(2); done(); }); }); @@ -3410,6 +3412,7 @@ describe('Wallet service', function() { tx.action.should.equal('sent'); tx.amount.should.equal(400); tx.fees.should.equal(100); + tx.time.should.equal(1); done(); }); }); @@ -3594,7 +3597,9 @@ describe('Wallet service', function() { }); it('should handle invalid tx in history ', function(done) { var h = _.clone(TestData.history); - h.push({txid:'xx'}) + h.push({ + txid: 'xx' + }) helpers.stubHistory(h); server.getTxHistory({}, function(err, txs) {