Page MenuHomePhabricator

Fix dbcrash spurious failures
ClosedPublic

Authored by Fabien on May 18 2020, 15:40.

Details

Summary

feature_dbcrash will sometime fail due to duplicated block hashes.
There is a chance that a block get invalidated, and there is a chance
that it only contains the coinbase. Since the address is now a constant,
and mining on regtest is fast, the block hash can end up being the same
that one from the invalidated chain.
This diff ensures that the block time is different to prevent such a
collision.

Test Plan
ninja check-functional-extended

You can help the test to fail (without this diff) by replacing the line:

if random.random() < 1.0 / (current_height + 4 - random_height):

with:

if random.random() < 1.0:

Event Timeline

Fabien requested review of this revision.May 18 2020, 15:40
This revision is now accepted and ready to land.May 18 2020, 16:48
This revision was automatically updated to reflect the committed changes.