Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
I haven't looked at the code or verified the issue but it seems to me the correct fix would be to prevent the user from putting a tx into the mempool when we don't want one to get there instead of letting them do it and then fail, even if it's a graceful failure with this change. |
ActivateSnapshot checks that the mempool is empty, then releases cs_main while PopulateAndValidateSnapshot runs, which can take minutes. A transaction added to the mempool in that window (e.g. through sendrawtransaction) made AddChainstate hit its empty-mempool assert after the base blockhash file was already written, and the node then needed -reindex to start again. Set a flag on ChainstateManager for the duration of ActivateSnapshot and reject transactions and packages in AcceptToMemoryPool and ProcessNewPackage while it is set. test_accept calls still work since they don't add anything to the mempool. A second concurrent loadtxoutset is rejected while the flag is set.
ceeee32 to
ca21d8f
Compare
|
Makes sense, changed it to that. While a snapshot is loading, AcceptToMemoryPool and ProcessNewPackage now reject with "snapshot-loading" (test_accept still works), so the load no longer fails because of the mempool. Updated the description and the test. |
|
I think this one more issue that is so fringe that we may not really want to address it. But if we would I prefer #36778 for a more structural solution. And there are further changes to this code upcoming with #36603 so I would rather close this or maybe it could be turned into an issue to make sure this doesn't get lost but even that is probably not worth it. |

ActivateSnapshotchecks that the mempool is empty before it starts, butPopulateAndValidateSnapshotthen runs withoutcs_main, which takes minutes on mainnet. A transaction entering the mempool in that window (e.g. throughsendrawtransaction) hits the assert inAddChainstate:By then the base blockhash file has been written, so the node needs
-reindexto start again.This sets a flag on
ChainstateManagerwhileActivateSnapshotruns, andAcceptToMemoryPoolandProcessNewPackagereject withsnapshot-loadingwhile it's set.testmempoolacceptstill works. A secondloadtxoutsetstarted while one is running is also rejected.test_mempool_blocked_during_loadinfeature_assumeutxo.pypauses the load through a FIFO, checks thatsendrawtransactionandsubmitpackageare rejected and the mempool stays empty, then lets the load finish. On master the transaction is accepted and the node aborts. The test is skipped whereos.mkfifoisn't available.