Page MenuHomePhabricator

[backport#16839] Avoid using g_rpc_node global in wallet code
ClosedPublic

Authored by majcosta on Jun 6 2020, 22:01.

Details

Summary

Wallet code should use interfaces::Chain and not directly access to node state.

Add a g_rpc_chain replacement global for wallet code to use, and move
g_rpc_node definition to a libbitcoin_server source file so there are link
errors if wallet code tries to access it.

https://github.com/bitcoin/bitcoin/pull/16839/commits/362ded410b8cb1104b7ef31ff8488fec4824a7d5


Depends on D6418

Concludes backport of Core PR16839

Test Plan
ninja check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

majcosta requested review of this revision.Jun 6 2020, 22:01

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

deadalnix requested changes to this revision.Jun 6 2020, 22:27
deadalnix added a subscriber: deadalnix.

What about src/rpc/blockchain.h ?

src/interfaces/wallet.cpp
501 ↗(On Diff #21005)

Why return? This does nothing, you can remove it.

src/wallet/rpcwallet.cpp
3167 ↗(On Diff #21005)

This isn't in the original PR. Can you explain?

This revision now requires changes to proceed.Jun 6 2020, 22:27

rebased onto missing deps, addressed comments

This revision is now accepted and ready to land.Jun 7 2020, 01:07