Skip to content

Commit

Permalink
mempool: reinsert claims and airdrops after reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
pinheadmz committed Jan 1, 2020
1 parent e5772db commit 6ae822c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/mempool/mempool.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,22 @@ class Mempool extends EventEmitter {
const remove = [];
const lockFlags = common.lockFlags.STANDARD_LOCKTIME_FLAGS;

this.dropClaims();
this.dropAirdrops();
this.contracts.clear();

for (const entry of this.claims.values()) {
const claim = Claim.fromBlob(entry.blob);
const data = claim.getData(this.network);
// The only thing that might make a Claim invalid when rewinding the
// blockchain is the inception time of the signatures in the DNSSEC proof.
if (this.chain.tip.time < data.inception) {
// Claim is not still valid, remove from mempool and contract state.
this.untrackClaim(entry);
} else {
// Claim IS still valid, keep in mempool and re-add to contract state.
this.contracts.addName(entry.namehash);
}
}

for (const [hash, entry] of this.map) {
const {tx} = entry;

Expand Down

0 comments on commit 6ae822c

Please sign in to comment.