mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:50:37 +00:00
test: deduplicate reorg test code #33959
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!33959
Loading…
Reference in a new issue
No description provided.
Delete branch "2025-11-followup_fix_reorgs_tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to #32587.
trigger_reorg()was copy-pasted across several functional tests. This moves it intoblocktools.py, together with the fork construction, as two helpers:create_empty_fork()andtrigger_reorg().The remaining tests that still simulated reorgs with the
invalidateblockRPC are converted to use them, sinceinvalidateblocktakes a different codepath than a reorg caused by a competing chain arriving.The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
A summary of reviews will appear here.
Conflicts
Reviewers, 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.
are you still working on this, or can it be closed?
Yes resumed the work, will push the update soon!
Updated the PR description and ready for review
@instagibbs do you want to take a look here?
I think this might be a bit of overengineering. Centralizing code is nice, but really I don't see the value of the added abstraction aside from centralizing trigger_reorg?
Addressed @instagibbs suggestion to only keep
trigger_reorgmethod in blocktools.py.wondering if there's a good place to add this removed comment to have people not reintroduce this pattern
stale comment with "invalid"
suggestion for wording:
are these nodes disconnected? I think it can be prepped once and used to trigger reorg on both sides?
no need for [0] subscript anymore
Maybe we can add in
create_empty_forkdocstring?Correct, they are connected. Will do the changes.
Thanks for the review @instagibbs
I've removed
Forkgeneratorclass and only kepttrigger_reorgin blocktools and addressed some comments.I have also updated PR title and the description.
🔵 Suggestion · Use the shared helper for the remaining fork submission
mempool_updatefromblock.py:195-196 still submits fork_blocks in an inline loop and skips the fork-tip assertion, even though trigger_reorg is imported and used elsewhere in the file. The same loop exists in base, so this PR did not introduce it; it is an incomplete migration.
Location:
test/functional/mempool_updatefromblock.py:193(head).Review coverage was incomplete.
Reviewed:
d72c022fa262· Full review report · Previous reportspermalink
🐙 This pull request conflicts with the target branch and needs rebase.
Ping for rebase @yuvicc
Rebased to master
🐙 This pull request conflicts with the target branch and needs rebase.
Rebased
ralph llm nit:
wallet_rescan_unconfirmed.py:49 still evaluates self.generate(tester_wallet, 1)[0] and discards the result. That index only existed to feed invalidateblock, which this PR replaced with trigger_reorg, so the PR left behind dead indexing.
Done, thanks.
Addressed ralph llvm review nit: removed unused block-hash indexing in
wallet_rescan_unconfirmed.py.