aboutsummaryrefslogtreecommitdiff
path: root/src/node
diff options
context:
space:
mode:
Diffstat (limited to 'src/node')
-rw-r--r--src/node/context.cpp3
-rw-r--r--src/node/context.h6
-rw-r--r--src/node/transaction.cpp8
3 files changed, 13 insertions, 4 deletions
diff --git a/src/node/context.cpp b/src/node/context.cpp
index 98cb061f19..26a01420c8 100644
--- a/src/node/context.cpp
+++ b/src/node/context.cpp
@@ -4,7 +4,10 @@
#include <node/context.h>
+#include <banman.h>
#include <interfaces/chain.h>
+#include <net.h>
+#include <net_processing.h>
NodeContext::NodeContext() {}
NodeContext::~NodeContext() {}
diff --git a/src/node/context.h b/src/node/context.h
index f98550105d..2b124af4db 100644
--- a/src/node/context.h
+++ b/src/node/context.h
@@ -8,6 +8,9 @@
#include <memory>
#include <vector>
+class BanMan;
+class CConnman;
+class PeerLogicValidation;
namespace interfaces {
class Chain;
class ChainClient;
@@ -25,6 +28,9 @@ class ChainClient;
//! be used without pulling in unwanted dependencies or functionality.
struct NodeContext
{
+ std::unique_ptr<CConnman> connman;
+ std::unique_ptr<PeerLogicValidation> peer_logic;
+ std::unique_ptr<BanMan> banman;
std::unique_ptr<interfaces::Chain> chain;
std::vector<std::unique_ptr<interfaces::ChainClient>> chain_clients;
diff --git a/src/node/transaction.cpp b/src/node/transaction.cpp
index 2577c25598..ba4f3c5370 100644
--- a/src/node/transaction.cpp
+++ b/src/node/transaction.cpp
@@ -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;