Browse Source

Merge pull request #2 from isocolsky/ref/cache

Fix confirmations
activeAddress
Matias Alejo Garcia 9 years ago
committed by GitHub
parent
commit
36d7724f1c
  1. 2
      lib/server.js
  2. 8
      test/integration/server.js

2
lib/server.js

@ -2838,7 +2838,7 @@ WalletService.prototype.getTxHistory = function(opts, cb) {
if (err || !height) return next(err);
_.each(txs, function(tx) {
if (tx.blockheight >= 0) {
tx.confirmations = height - tx.blockheight;
tx.confirmations = height - tx.blockheight + 1;
}
});
next();

8
test/integration/server.js

@ -6271,7 +6271,7 @@ describe('Wallet service', function() {
calls[0].args[3].length.should.equal(5); // 5 txs have confirmations>= 100
// should be reversed!
calls[0].args[3][0].confirmations.should.equal(currentHeight - (totalItems - (skip + limit)));
calls[0].args[3][0].confirmations.should.equal(currentHeight - (totalItems - (skip + limit)) + 1);
calls[0].args[3][0].txid.should.equal(h[skip + limit - 1].txid);
server.storage.storeTxHistoryCache.restore();
done();
@ -6325,7 +6325,7 @@ describe('Wallet service', function() {
calls[0].args[3].length.should.equal(5);
// should be reversed!
calls[0].args[3][0].confirmations.should.equal(currentHeight);
calls[0].args[3][0].confirmations.should.equal(currentHeight + 1);
calls[0].args[3][0].txid.should.equal(h[totalItems - 1].txid);
server.storage.storeTxHistoryCache.restore();
done();
@ -6354,8 +6354,8 @@ describe('Wallet service', function() {
var calls = storeTxHistoryCacheSpy.getCalls();
calls.length.should.equal(1);
_.first(txs).confirmations.should.equal(81);
_.last(txs).confirmations.should.equal(100);
_.first(txs).confirmations.should.equal(82);
_.last(txs).confirmations.should.equal(101);
server.storage.storeTxHistoryCache.restore();
Defaults.CONFIRMATIONS_TO_START_CACHING = _confirmations;

Loading…
Cancel
Save