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:

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Fabien created this revision.May 18 2020, 15:40
Herald added a reviewer: Restricted Project. · View Herald TranscriptMay 18 2020, 15:40
Fabien requested review of this revision.May 18 2020, 15:40
jasonbcox accepted this revision.May 18 2020, 16:48
jasonbcox added a subscriber: jasonbcox.

Macro likestamp:

This revision is now accepted and ready to land.May 18 2020, 16:48
Fabien updated this revision to Diff 20224.May 18 2020, 18:40

Slightly better comment

This revision was automatically updated to reflect the committed changes.