spvnode: do not attempt to insert wdb txs twice.

This commit is contained in:
Christopher Jeffrey 2016-12-22 03:55:04 -08:00
parent 0eaa26a374
commit bb11cfc021
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -140,26 +140,28 @@ SPVNode.prototype._init = function _init() {
}); });
this.pool.on('tx', function(tx) { this.pool.on('tx', function(tx) {
self.emit('tx', tx);
if (self.rescanJob) if (self.rescanJob)
return; return;
self.walletdb.addTX(tx).catch(onError); self.emit('tx', tx);
}); });
this.chain.on('block', function(block) { this.chain.on('block', function(block) {
self.emit('block', block); self.emit('block', block);
}); });
this.chain.on('connect', function(entry, block) { this.chain.on('connect', co(function* (entry, block) {
if (self.rescanJob) { if (self.rescanJob) {
self.watchBlock(entry, block).catch(onError); try {
yield self.watchBlock(entry, block);
} catch (e) {
self._error(e);
}
return; return;
} }
self.emit('connect', entry, block); self.emit('connect', entry, block);
}); }));
this.chain.on('disconnect', function(entry, block) { this.chain.on('disconnect', function(entry, block) {
self.emit('disconnect', entry); self.emit('disconnect', entry);