Skip to content

Conversation

fjahr
Copy link
Contributor

@fjahr fjahr commented Jun 26, 2022

This removes generation of 6 blocks and replaces is with a sync_all in the importdescriptors test.

The generated blocks themself don't seem to serve any purpose in the test. Instead they could make the test flaky (although I did not find open issues pointing to this happening in practice in the CI). Right before the blocks being generated a transaction is created (L454) and later in the test this tx is assumed to be still in the mempool. If the nodes were to sync their mempools before the blocks are generated, the test fails. It currently only seems to work because one node sends the tx while the other generates the blocks and the mempools are not synced fast enough.

The sync_all is still needed to let nodes catch up at that point. Otherwise races happen further below which the generate call seems to have prevented so far.

@fanquake fanquake added the Tests label Jun 26, 2022
@fjahr fjahr changed the title test: Remove unnecessary block mining from importdescriptors test test: Remove unnecessary mining from importdescriptors test Jun 26, 2022
@fjahr
Copy link
Contributor Author

fjahr commented Jun 26, 2022

Credit to @w0xlt for noticing something was off there

@laanwj
Copy link
Member

laanwj commented Jun 26, 2022

Code review ACK e3d8d72

If the nodes were to sync their mempools before the blocks are generated, the test fails.

I think the PR title undersells it. The mining is not only unnecessary, but can actively cause failures.

@maflcko maflcko merged commit c1acd34 into bitcoin:master Jun 27, 2022
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 27, 2022
…iptors test

e3d8d72 test: Remove unnecessary block mining from importdescriptors test (Fabian Jahr)

Pull request description:

  This removes generation of 6 blocks and replaces is with a `sync_all` in the `importdescriptors` test.

  The generated blocks themself don't seem to serve any purpose in the test. Instead they could make the test flaky (although I did not find open issues pointing to this happening in practice in the CI). Right before the blocks being generated a transaction is created (L454) and later in the test this tx is assumed to be still in the mempool. If the nodes were to sync their mempools before the blocks are generated, the test fails. It currently only seems to work because one node sends the tx while the other generates the blocks and the mempools are not synced fast enough.

  The `sync_all` is still needed to let nodes catch up at that point. Otherwise races happen further below which the generate call seems to have prevented so far.

ACKs for top commit:
  laanwj:
    Code review ACK e3d8d72

Tree-SHA512: 14f3dc2938d779d1ad43e09a7e046523fc3c92f41df012833f279a2e88e74c2fcab301fe4f3fcc038bd8460ea1360725a8d1eb5b59acd1039495bacb484fd790
@bitcoin bitcoin locked and limited conversation to collaborators Jun 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants