Skip to content
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

Merged
merged 2 commits into from
Jun 5, 2020
Merged

Remove g_rpc_chain global #19096

merged 2 commits into from
Jun 5, 2020

Conversation

ryanofsky
Copy link
Contributor

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.

ryanofsky and others added 2 commits May 28, 2020 02:13
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>
@practicalswift
Copy link
Contributor

Concept ACK

@DrahtBot
Copy link
Contributor

DrahtBot commented May 28, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

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.

Copy link
Member

@promag promag left a 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.

src/interfaces/wallet.cpp Outdated Show resolved Hide resolved
src/wallet/rpcwallet.cpp Show resolved Hide resolved
Copy link
Contributor Author

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for simplification and review

Updated 2058621 -> e1cfcd4 (pr/wc.1 -> pr/wc.2, compare) with suggested change

src/interfaces/wallet.cpp Outdated Show resolved Hide resolved
src/wallet/rpcwallet.cpp Show resolved Hide resolved
@promag
Copy link
Member

promag commented May 31, 2020

ACK e1cfcd4.

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK e1cfcd4

src/rpc/request.h Outdated Show resolved Hide resolved
src/wallet/rpcwallet.cpp Show resolved Hide resolved
Copy link
Contributor Author

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for review!

Updated e1cfcd4 -> 4a7253a (pr/wc.2 -> pr/wc.3, compare)

src/rpc/request.h Outdated Show resolved Hide resolved
src/wallet/rpcwallet.cpp Show resolved Hide resolved
Copy link
Contributor

@ariard ariard left a 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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@maflcko
Copy link
Member

maflcko commented Jun 2, 2020

ACK 4a7253a 🎋

Show signature and timestamp

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

ACK 4a7253ab6c3bb323581cea54573529c2f823f035 🎋
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUjJGQwAmXh+3GnuU8VGHIDajsI/sbNPuX1JJO4IAE5er+oHyDEebO2WCTwzymi7
GswRu7Iol7P57sF5FtVTO1ozDSppq2qOrUEMU7p6CUrBq132GaA08uf9YbE0mx34
B+dCmhW0qE320G/iZY/pevTiBnhKJagq/MHb31eRCGGDxpcskdJUUY5LPTZVuH33
bwnMlVHjaO7Mm+JsrGNx4VpGUwh5LAR8XI1NqsDQu5Rbp18et5h1oc++AR9+qvhn
Cf2lC6r9A3me5r9GO+766hZ52hgBVGXIG3UWV6xQ1tHA4j+Kdptwag3wbG+w49Zh
7VEk2Zt88SOxLI/qdg7andf2j5EmUFvBWbgZLYx83+/IvXOcZ/cyZFFB67tA2SVp
vMCsbbFS3IDlB0Cfo09RkJwK3dn9EV0iGlr3noPUYr1JvGemVEYNgthF7t+hrCYk
goyZSPcM30KJ4WJeG0TenWdK7eD5Y27Xj4yqBic/86zij2ixSUEP/jqPUSrVSkIG
CsoSWkO0
=tBE9
-----END PGP SIGNATURE-----

Timestamp of file with hash 4ff2c313852eb5872f3d1eec1aa996276e07d1a8f4efe878195311834e130a3c -

@maflcko
Copy link
Member

maflcko commented Jun 5, 2020

@ryanofsky What is the status of this? I am currently undecided on whether to send this into rebase hell or merge.

Copy link
Contributor Author

@ryanofsky ryanofsky left a 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):

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
Copy link
Contributor Author

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.

@maflcko maflcko merged commit 0fc6ea2 into bitcoin:master Jun 5, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 5, 2020
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
domob1812 added a commit to domob1812/namecoin-core that referenced this pull request Jun 8, 2020
getauxblock is still broken due to
bitcoin/bitcoin#19096 and will be fixed
in a follow-up commit.
domob1812 added a commit to domob1812/namecoin-core that referenced this pull request Jun 8, 2020
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.
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Dec 7, 2020
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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants