You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #21391: [Bundle 5/n] Prune g_chainman usage in RPC modules
586190f rpc/rest: Take and reuse local Chain/ChainState obj (Carl Dong)
bc3bd36 rpc: style: Improve BuriedForkDescPushBack signature (Carl Dong)
f999139 rpc: Remove unnecessary casting of block height (Carl Dong)
6a3d192 rpc: Tidy up local references (see commit message) (Carl Dong)
038854f rest/rpc: Remove now-unused old Ensure functions (Carl Dong)
6fb65b4 scripted-diff: rest/rpc: Use renamed EnsureAny*() (Carl Dong)
1570c7e rpc: Add renamed EnsureAny*() functions (Carl Dong)
306b1cd rpc: Add alt Ensure* functions acepting NodeContext (Carl Dong)
d7824ac rest: Use existing NodeContext (Carl Dong)
3f08934 rest: Pass in NodeContext to rest_block (Carl Dong)
7be0671 rpc/rawtx: Use existing NodeContext (Carl Dong)
60dc05a rpc/mining: Use existing NodeContext (Carl Dong)
d485e81 rpc/blockchain: Use existing NodeContext (Carl Dong)
d0abf0b rpc/*,rest: Add review-only assertion to EnsureChainman (Carl Dong)
cced0f4 miner: Pass in previous CBlockIndex to RegenerateCommitments (Carl Dong)
Pull request description:
Overall PR: #20158 (tree-wide: De-globalize ChainstateManager)
Based on:
- [x] #21270 | [Bundle 4/n] Prune g_chainman usage in validation-adjacent modules
- [x] #21525 | [Bundle 4.5/n] Followup fixups to bundle 4
Note to reviewers:
1. This bundle may _apparently_ introduce usage of `g_chainman` or `::Chain(state|)Active()` globals, but these are resolved later on in the overall PR. [Commits of overall PR](https://github.com/bitcoin/bitcoin/pull/20158/commits)
2. There may be seemingly obvious local references to `ChainstateManager` or other validation objects which are not being used in callers of the current function in question, this is done intentionally to **_keep each commit centered around one function/method_** to ease review and to make the overall change systematic. We don't assume anything about our callers. Rest assured that once we are considering that particular caller in later commits, we will use the obvious local references. [Commits of overall PR](https://github.com/bitcoin/bitcoin/pull/20158/commits)
3. When changing a function/method that has many callers (e.g. `LookupBlockIndex` with 55 callers), it is sometimes easier (and less error-prone) to use a scripted-diff. When doing so, there will be 3 commits in sequence so that every commit compiles like so:
1. Add `new_function`, make `old_function` a wrapper of `new_function`, divert all calls to `old_function` to `new_function` **in the local module only**
2. Scripted-diff to divert all calls to `old_function` to `new_function` **in the rest of the codebase**
3. Remove `old_function`
ACKs for top commit:
ryanofsky:
Code review ACK 586190f. Since last review, no changes to existing commits, just some simple new commits added: three new commits renaming std::any Ensure functions (scripted diff commit and manual pre/post commits), and one new commit factoring out a repeated `ActiveChain()` call made in a loop. Thanks for the updates!
jnewbery:
utACK 586190f
MarcoFalke:
review ACK 586190f 🍯
Tree-SHA512: 64b677fb50141805b55c3f1afe68fcd298f9a071a359bdcd63256d52e334f83e462f31fb3ebee9b630da8f1d912a03a128cfc38179e7aaec29a055744a98478c
0 commit comments