Page MenuHomePhabricator

[backport#16839] scripted-diff: Remove g_connman, g_banman globals
ClosedPublic

Authored by majcosta on Jun 6 2020, 21:59.

Details

Summary
-BEGIN VERIFY SCRIPT-
sed -i 's:#include <interfaces/chain.h>:#include <banman.h>\n#include<interfaces/chain.h>\n#include <net.h>\n#include <net_processing.h>:' src/node/context.cpp
sed -i 's/namespace interfaces {/class BanMan;\nclass CConnman;\nclass PeerLogicValidation;\n&/' src/node/context.h
sed -i 's/std::unique_ptr<interfaces::Chain>chain/std::unique_ptr<CConnman> connman;\n   std::unique_ptr<PeerLogicValidation> peer_logic;\nstd::unique_ptr<BanMan> banman;\n    &/' src/node/context.h
sed -i '/std::unique_ptr<[^>]\+> \(g_connman\|g_banman\|peerLogic\);/d'src/banman.h src/net.h src/init.cpp
sed -i 's/g_connman/m_context.connman/g' src/interfaces/node.cpp
sed -i 's/g_banman/m_context.banman/g' src/interfaces/node.cpp
sed -i 's/g_connman/m_node.connman/g' src/interfaces/chain.cpp src/test/util/setup_common.cpp
sed -i 's/g_banman/m_node.banman/g' src/test/util/setup_common.cpp
sed -i 's/g_connman/node.connman/g' src/init.cpp src/node/transaction.cpp
sed -i 's/g_banman/node.banman/g' src/init.cpp
sed -i 's/peerLogic/node.peer_logic/g' src/init.cpp
sed -i 's/g_connman/g_rpc_node->connman/g' src/rpc/mining.cpp src/rpc/net.cpp src/rpc/rawtransaction.cpp
sed -i 's/g_banman/g_rpc_node->banman/g' src/rpc/net.cpp
sed -i 's/std::shared_ptr<CWallet> wallet =/node.context()->connman = std::move(test.m_node.connman);\n    &/' src/qt/test/wallettests.cpp
-END VERIFY SCRIPT-

ALSO the changes to src/test/util/setup_common.cpp and src/rpc/blockchain.h from the following diff have been anticipated into this one because boost test failures.

https://github.com/bitcoin/bitcoin/pull/16839/commits/8922d7f6b751a3e6b3b9f6fb7961c442877fb65a


Partial backport of Core PR16839

Test Plan
ninja check-all

Event Timeline

majcosta requested review of this revision.Jun 6 2020, 21:59

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

majcosta edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Jun 6 2020, 22:30