mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
scripted-diff: Remove g_connman, g_banman globals
-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;\n std::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/setup_common.cpp
sed -i 's/g_banman/m_node.banman/g' src/test/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-
This commit is contained in:
@@ -17,9 +17,9 @@
|
||||
TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef tx, std::string& err_string, const CAmount& max_tx_fee, bool relay, bool wait_callback)
|
||||
{
|
||||
// BroadcastTransaction can be called by either sendrawtransaction RPC or wallet RPCs.
|
||||
// g_connman is assigned both before chain clients and before RPC server is accepting calls,
|
||||
// and reset after chain clients and RPC sever are stopped. g_connman should never be null here.
|
||||
assert(g_connman);
|
||||
// node.connman is assigned both before chain clients and before RPC server is accepting calls,
|
||||
// and reset after chain clients and RPC sever are stopped. node.connman should never be null here.
|
||||
assert(node.connman);
|
||||
std::promise<void> promise;
|
||||
uint256 hashTx = tx->GetHash();
|
||||
bool callback_set = false;
|
||||
@@ -80,7 +80,7 @@ TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef t
|
||||
}
|
||||
|
||||
if (relay) {
|
||||
RelayTransaction(hashTx, *g_connman);
|
||||
RelayTransaction(hashTx, *node.connman);
|
||||
}
|
||||
|
||||
return TransactionError::OK;
|
||||
|
||||
Reference in New Issue
Block a user