test: run sigops tests without cache.
This commit is contained in:
parent
d33443186c
commit
b3f02eb70a
@ -359,18 +359,22 @@ describe('Block', function() {
|
|||||||
|
|
||||||
for (const [name, sigops, weight] of sigopsVectors) {
|
for (const [name, sigops, weight] of sigopsVectors) {
|
||||||
const ctx = common.readBlock(name);
|
const ctx = common.readBlock(name);
|
||||||
it(`should count sigops for ${name}`, () => {
|
for (const cache of [false, true]) {
|
||||||
const [block, view] = ctx.getBlock();
|
const word = cache ? 'with' : 'without';
|
||||||
const flags = Script.flags.VERIFY_P2SH | Script.flags.VERIFY_WITNESS;
|
it(`should count sigops for ${name} (${word} cache)`, () => {
|
||||||
|
const [block, view] = ctx.getBlock();
|
||||||
|
const flags = Script.flags.VERIFY_P2SH | Script.flags.VERIFY_WITNESS;
|
||||||
|
|
||||||
let count = 0;
|
if (!cache)
|
||||||
for (const tx of block.txs)
|
block.refresh(true);
|
||||||
count += tx.getSigopsCost(view, flags);
|
|
||||||
|
|
||||||
assert.strictEqual(count, sigops);
|
let count = 0;
|
||||||
assert.strictEqual(block.getWeight(), weight);
|
for (const tx of block.txs)
|
||||||
block.refresh();
|
count += tx.getSigopsCost(view, flags);
|
||||||
assert.strictEqual(block.getWeight(), weight);
|
|
||||||
});
|
assert.strictEqual(count, sigops);
|
||||||
|
assert.strictEqual(block.getWeight(), weight);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user