diff options
author | fanquake <fanquake@gmail.com> | 2024-02-13 09:40:22 -0300 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2024-02-13 09:43:08 -0300 |
commit | 3054416f62644120a4a6bc76e927054c7fbbd487 (patch) | |
tree | 784ec2e1d5c850628e9d1e29d5c7557f16220299 /test | |
parent | 6ff0aa089c01ff3e610ecb47814ed739d685a14c (diff) | |
parent | 44d11532f80705b790bc6e28df9a96ac54b25f9b (diff) |
Merge bitcoin/bitcoin#29425: test: fix intermittent failure in wallet_reorgrestore.py
44d11532f80705b790bc6e28df9a96ac54b25f9b test: fix intermittent failure in wallet_reorgrestore.py (Martin Zumsande)
Pull request description:
By adding a missing `sync_blocks` call.
There was a race at `node2` between connecting the block produced by `node0`, and using `-generate` to create new blocks itself. In the failed run, block generation started before connecting the block, resulting in a final block height that was smaller by 1 than expected.
See https://github.com/bitcoin/bitcoin/issues/29392#issuecomment-1939541603 for a more detailed analysis of the failed run.
Can be reproduced by adding a sleep to [this spot](https://github.com/bitcoin/bitcoin/blob/6ff0aa089c01ff3e610ecb47814ed739d685a14c/src/validation.cpp#L4217) in `ChainstateManager::ProcessNewBlock()`:
```
if (util::ThreadGetInternalName() == "msghand") {
std::this_thread::sleep_for(0.2s);
}
```
which fails for me on master and succeeds with the fix.
Fixes #29392
ACKs for top commit:
maflcko:
lgtm ACK 44d11532f80705b790bc6e28df9a96ac54b25f9b
Tree-SHA512: c08699e5ae348d4c0626022b519449d052f511d3f44601bcd8dac836a130a3f67fca149532e1e3690367ebfdcbcdd32e527170d039209c1f599ce861136ae29f
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/wallet_reorgsrestore.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/functional/wallet_reorgsrestore.py b/test/functional/wallet_reorgsrestore.py index 86a2905c72..4271f3e481 100755 --- a/test/functional/wallet_reorgsrestore.py +++ b/test/functional/wallet_reorgsrestore.py @@ -45,6 +45,7 @@ class ReorgsRestoreTest(BitcoinTestFramework): txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), Decimal("10")) tx = self.nodes[0].gettransaction(txid) self.generate(self.nodes[0], 4, sync_fun=self.no_op) + self.sync_blocks([self.nodes[0], self.nodes[2]]) tx_before_reorg = self.nodes[0].gettransaction(txid) assert_equal(tx_before_reorg["confirmations"], 4) |