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 #6732: backport: merge bitcoin#23497 (Add src/node/ and src/wallet/ code to node:: and wallet:: namespaces)
ab9ba84 refactor: complete migration of code to `wallet::` namespace (Kittywhiskers Van Gogh)
1c2d529 refactor: add `src/wallet/*` code to `wallet::` namespace (Kittywhiskers Van Gogh)
81c6880 refactor: complete migration of code to `node::` namespace (Kittywhiskers Van Gogh)
ddbc294 refactor: add `src/node/*` to `node::` namespace (Kittywhiskers Van Gogh)
65cfaea refactor: add `src/node/context.*` to `node::` namespace (Kittywhiskers Van Gogh)
e89e8a7 refactor: move `CBlockFileInfo::ToString` method where class is declared (Kittywhiskers Van Gogh)
7991bbb refactor: disambiguate presence of `cs_main` in global namespace (Kittywhiskers Van Gogh)
Pull request description:
## Additional Information
* [bitcoin#23497](bitcoin#23497) was merged upstream in v0.23. As of this writing, the backport backlog for v0.23 is at ~91% completion. This change, while conflict-prone, is long-overdue as we have been backporting pull requests from v0.24 onwards that assume these namespaces and so far we've simply "cut out" those portions to allow those backports to be completed.
* This is not sustainable, especially with the work undertaken for `bitcoin-chainstate` (see [bitcoin#24304](bitcoin#24304) and onwards), that are invested in these separation of concerns.
* Due to the increased usage of namespacing, to avoid potential `-Werror=thread-safety-analysis` issues (see below), the usage of `cs_main` needs to be disambiguated as being a part of the global namespace, to that effect, changes have been made to ensure that in Dash-specific code and anywhere else needed to quell compiler errors.
<details>
<summary>Build error:</summary>
```
wallet/test/wallet_tests.cpp:162:31: error: calling function 'GetBlockPos' requires holding mutex 'cs_main' exclusively [-Werror,-Wthread-safety-analysis]
162 | file_number = oldTip->GetBlockPos().nFile;
| ^
wallet/test/wallet_tests.cpp:163:45: error: calling function 'PruneOneBlockFile' requires holding mutex 'cs_main' exclusively [-Werror,-Wthread-safety-analysis]
163 | Assert(m_node.chainman)->m_blockman.PruneOneBlockFile(file_number);
| ^
wallet/test/wallet_tests.cpp:190:31: error: calling function 'GetBlockPos' requires holding mutex 'cs_main' exclusively [-Werror,-Wthread-safety-analysis]
190 | file_number = newTip->GetBlockPos().nFile;
| ^
wallet/test/wallet_tests.cpp:191:45: error: calling function 'PruneOneBlockFile' requires holding mutex 'cs_main' exclusively [-Werror,-Wthread-safety-analysis]
191 | Assert(m_node.chainman)->m_blockman.PruneOneBlockFile(file_number);
| ^
wallet/test/wallet_tests.cpp:227:31: error: calling function 'GetBlockPos' requires holding mutex 'cs_main' exclusively [-Werror,-Wthread-safety-analysis]
227 | file_number = oldTip->GetBlockPos().nFile;
| ^
wallet/test/wallet_tests.cpp:228:45: error: calling function 'PruneOneBlockFile' requires holding mutex 'cs_main' exclusively [-Werror,-Wthread-safety-analysis]
228 | Assert(m_node.chainman)->m_blockman.PruneOneBlockFile(file_number);
| ^
wallet/test/wallet_tests.cpp:386:34: error: calling function 'BlockIndex' requires holding mutex 'cs_main' exclusively [-Werror,-Wthread-safety-analysis]
386 | auto inserted = chainman.BlockIndex().emplace(std::piecewise_construct, std::make_tuple(GetRandHash()), std::make_tuple());
| ^`
```
</details>
* Some commits have been split out to ease in the review process, due to the nature of changes, except for `NodeContext` (`node/context.{cpp,h}`), they could not be done on a file-to-file basis as it would create substantial diffs that would then be reverted in the next commit, which would make review _harder_.
* Correctness of this pull request can be evaluated by comparing against [bitcoin#23497](bitcoin#23497), the `25.x` branch upstream for changes affecting upstream code not present during the backport ([source](https://github.com/bitcoin/bitcoin/tree/25.x)) and compiler output for Dash-specific code.
## Checklist
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)**
- [x] I have added or updated relevant unit/integration/functional/e2e tests
- [x] I have made corresponding changes to the documentation **(note: N/A)**
- [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_
ACKs for top commit:
PastaPastaPasta:
utACK ab9ba84
UdjinM6:
utACK ab9ba84
Tree-SHA512: 8ff2bcfd76d5170c3af38e2c7b60d5daf467793e84bfef8254f325d6919f637451045157fde73a1d35d5d378bfea47625f72ec250815fd2603bca1339d89f31e
0 commit comments