Skip to content

Commit

Permalink
test: reset ownership.ignore after fakeclaim tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pinheadmz committed Jan 1, 2020
1 parent 74267ea commit fd759a6
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions test/mempool-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -925,11 +925,21 @@ describe('Mempool', function() {
const data = claim.getData(mempool.network);
const [block1] = await getMockBlock(chain);
block1.time = data.inception + 100;
ownership.ignore = true;
const entry1 = await chain.add(block1, VERIFY_BODY);
let entry1;
try {
ownership.ignore = true;
entry1 = await chain.add(block1, VERIFY_BODY);
} finally {
ownership.ignore = false;
}

// Now we can add it to the mempool.
await mempool.addClaim(claim);
try {
ownership.ignore = true;
await mempool.addClaim(claim);
} finally {
ownership.ignore = false;
}
assert.strictEqual(mempool.claims.size, 1);
assert(mempool.getClaim(claim.hash()));

Expand All @@ -938,8 +948,14 @@ describe('Mempool', function() {
const cb = claim.toTX(mempool.network, chain.tip.height + 1);
cb.locktime = chain.tip.height + 1;
const [block2, view2] = await getMockBlock(chain, [cb], false);
const entry2 = await chain.add(block2, VERIFY_BODY);
await mempool._addBlock(entry2, block2.txs, view2);
let entry2;
try {
ownership.ignore = true;
entry2 = await chain.add(block2, VERIFY_BODY);
await mempool._addBlock(entry2, block2.txs, view2);
} finally {
ownership.ignore = false;
}

// Mempool is empty
assert.strictEqual(mempool.claims.size, 0);
Expand Down

0 comments on commit fd759a6

Please sign in to comment.