Browse Source

Merge pull request #445 from matiu/feat/invalid-txs

ignore invalid TXs
activeAddress
Matias Alejo Garcia 9 years ago
parent
commit
c417367ca7
  1. 2
      lib/server.js
  2. 5
      test/integration/server.js

2
lib/server.js

@ -2202,6 +2202,7 @@ WalletService.prototype.getTxHistory = function(opts, cb) {
} else { } else {
action = 'invalid'; action = 'invalid';
amount = 0; amount = 0;
log.warn("Got Invalid TX from address:", JSON.stringify(tx));
} }
function outputMap(o) { function outputMap(o) {
@ -2282,6 +2283,7 @@ WalletService.prototype.getTxHistory = function(opts, cb) {
var txs = res[1]; var txs = res[1];
txs = decorate(txs, addresses, proposals); txs = decorate(txs, addresses, proposals);
txs = _.filter(txs, function(tx) { return tx.action != 'invalid' })
return cb(null, txs); return cb(null, txs);
}); });

5
test/integration/server.js

@ -4816,7 +4816,7 @@ describe('Wallet service', function() {
done(); done();
}); });
}); });
it('should handle invalid tx in history ', function(done) { it('should handle filter out invalid txs in history ', function(done) {
var h = _.clone(TestData.history); var h = _.clone(TestData.history);
h.push({ h.push({
txid: 'xx' txid: 'xx'
@ -4827,8 +4827,7 @@ describe('Wallet service', function() {
server.getTxHistory({}, function(err, txs) { server.getTxHistory({}, function(err, txs) {
should.not.exist(err); should.not.exist(err);
should.exist(txs); should.exist(txs);
txs.length.should.equal(l + 1); txs.length.should.equal(l);
txs[l].action.should.equal('invalid');
done(); done();
}); });
}); });

Loading…
Cancel
Save