mempool: add double spend events.

This commit is contained in:
Christopher Jeffrey 2017-02-28 23:19:11 -08:00
parent 7a1e539700
commit 3988d2766d
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -823,6 +823,7 @@ Mempool.prototype.insertTX = co(function* insertTX(tx) {
// not double-spending an output in the
// mempool.
if (this.isDoubleSpend(tx)) {
this.emit('conflict', tx);
throw new VerifyError(tx,
'duplicate',
'bad-txns-inputs-spent',
@ -1895,6 +1896,8 @@ Mempool.prototype.removeDoubleSpends = function removeDoubleSpends(tx) {
spent.tx.rhash());
this.removeEntry(spent, true);
this.emit('double spend', spent);
}
};