-
Notifications
You must be signed in to change notification settings - Fork 36.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove g_rpc_chain global #19096
Remove g_rpc_chain global #19096
Conversation
Replace with RPC request reference to new WalletContext struct similar to the existing NodeContext struct and reference. This PR is a followup to 25ad2c6 bitcoin#18740 removing the g_rpc_node global. Some later PRs will follow this up and move more wallet globals to the WalletContext struct. Co-authored-by: João Barbosa <joao.paulo.barbosa@gmail.com>
Concept ACK |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach ACK, just two comments before ACK code change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK e1cfcd4. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK e1cfcd4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review ACK 4a7253a, feel free to ignore comment it's super nit.
Thanks to removing global in RPC, I think it would make it simpler to remove RPC methods from the Chain interface, and have the wallet listen on its own ports?
class Chain; | ||
} // namespace interfaces | ||
|
||
//! WalletContext struct containing references to state shared between CWallet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it has to contain references for multiple wallet why not call it WalletsContext
? We have one node but maybe multiple wallets connected to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re: #19096 (comment)
If it has to contain references for multiple wallet why not call it
WalletsContext
? We have one node but maybe multiple wallets connected to it.
I think using "wallets" instead of "wallet" is good where it can prevent ambiguity and misuse (#12221), but using plural where a name might apply to more than one object doesn't always sound right (hairscut, sailsboat) and can create confusion on its on (-disablewallets, -walletsnotify) because it can imply some instead of all. In this case, I think wallets is more distracting and doesn't sound right.
ACK 4a7253a 🎋 Show signature and timestampSignature:
Timestamp of file with hash |
@ryanofsky What is the status of this? I am currently undecided on whether to send this into rebase hell or merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re: MarcoFalke #19096 (comment)
@ryanofsky What is the status of this? I am currently undecided on whether to send this into rebase hell or merge.
Status is fine to merge as far as I know. It doesn't seem to conflict with very much #19096 (comment):
- refactor: Combine GetWalletForJSONRPCRequest and EnsureWalletIsAvailable functions #19100 (refactor: Combine GetWalletForJSONRPCRequest and EnsureWalletIsAvailable functions by ryanofsky)
- wallet: Never schedule MaybeCompactWalletDB when -flushwallet is off #18923 (wallet: Never schedule MaybeCompactWalletDB when -flushwallet is off by MarcoFalke)
- Use shared pointers only in validation interface #18354 (Use shared pointers only in validation interface by bvbfan)
re: ariard #19096 (review)
Thanks to removing global in RPC, I think it would make it simpler to remove RPC methods from the Chain interface, and have the wallet listen on its own ports?
Adding listening ports is a good idea and has been suggested before. It's true that if it were implemented and backwards compatibility were dropped this PR would be slightly simpler. But I wouldn't want to implement a new feature and break existing usage cases just to remove a global variable.
class Chain; | ||
} // namespace interfaces | ||
|
||
//! WalletContext struct containing references to state shared between CWallet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re: #19096 (comment)
If it has to contain references for multiple wallet why not call it
WalletsContext
? We have one node but maybe multiple wallets connected to it.
I think using "wallets" instead of "wallet" is good where it can prevent ambiguity and misuse (#12221), but using plural where a name might apply to more than one object doesn't always sound right (hairscut, sailsboat) and can create confusion on its on (-disablewallets, -walletsnotify) because it can imply some instead of all. In this case, I think wallets is more distracting and doesn't sound right.
4a7253a Remove g_rpc_chain global (Russell Yanofsky) e783197 refactor: replace RegisterWalletRPCCommands with GetWalletRPCCommands (Russell Yanofsky) Pull request description: Replace with RPC request reference to new WalletContext struct similar to the existing NodeContext struct and reference. This PR is a followup to bitcoin#18740 removing the g_rpc_node global. Some later PRs will follow this up and move more wallet globals to the WalletContext struct. ACKs for top commit: MarcoFalke: ACK 4a7253a 🎋 ariard: Code Review ACK 4a7253a, feel free to ignore comment it's super nit. Tree-SHA512: 5bb5561c89f81811ca5232a58bf450e230d4218e62471c03227d142395fd36131672e99cb88329b33b9680a235db01e8b9d1c1e2a18288349e57205528deabab
getauxblock is still broken due to bitcoin/bitcoin#19096 and will be fixed in a follow-up commit.
Unlike any upstream method, getauxblock is a wallet method but needs the NodeContext. This got broken with the upstream change in bitcoin/bitcoin#19096, because now the request context is a WalletContext. To fix it, we add a NodeContext pointer to WalletContext and in this way pass both to the wallet methods. EnsureNodeContext is able to extract the NodeContext then accordingly in both cases.
Summary: ``` Replace with RPC request reference to new WalletContext struct similar to the existing NodeContext struct and reference. This PR is a followup to #18740 removing the g_rpc_node global. Some later PRs will follow this up and move more wallet globals to the WalletContext struct. ``` Backport of core [[bitcoin/bitcoin#19096 | PR19096]]. Adapted to match our wallet dump RPCs separation. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Subscribers: majcosta Differential Revision: https://reviews.bitcoinabc.org/D8586
Replace with RPC request reference to new WalletContext struct similar to the existing NodeContext struct and reference.
This PR is a followup to #18740 removing the g_rpc_node global.
Some later PRs will follow this up and move more wallet globals to the WalletContext struct.