HomePhabricator

Fix dbcrash spurious failures

Description

Fix dbcrash spurious failures

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:

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Subscribers: jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D6116

Details

Provenance
FabienAuthored on May 18 2020, 15:12
FabienPushed on May 18 2020, 19:02
Reviewer
Restricted Project
Differential Revision
D6116: Fix dbcrash spurious failures
Parents
rABCe02a92dc3354: Fix Flake8 E741 errors
Branches
Unknown
Tags
Unknown