aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/chain.cpp
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2019-09-17 18:28:03 -0400
committerRussell Yanofsky <russ@yanofsky.org>2019-10-28 10:30:51 -0400
commite6f4f895d5e42feaf7bfa5f41e80292aaa73cd7d (patch)
tree1c12f814ae2ac88316066d334274354c669d7aa5 /src/interfaces/chain.cpp
parent4d5448c76b71c9d91399c31b043237091be2e5e7 (diff)
downloadbitcoin-e6f4f895d5e42feaf7bfa5f41e80292aaa73cd7d.tar.xz
Pass NodeContext, ConnMan, BanMan references more places
So g_connman and g_banman globals can be removed next commit.
Diffstat (limited to 'src/interfaces/chain.cpp')
-rw-r--r--src/interfaces/chain.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp
index b2c20573fb..23099a7799 100644
--- a/src/interfaces/chain.cpp
+++ b/src/interfaces/chain.cpp
@@ -11,6 +11,7 @@
#include <net.h>
#include <net_processing.h>
#include <node/coin.h>
+#include <node/context.h>
#include <node/transaction.h>
#include <policy/fees.h>
#include <policy/policy.h>
@@ -238,6 +239,7 @@ public:
class ChainImpl : public Chain
{
public:
+ explicit ChainImpl(NodeContext& node) : m_node(node) {}
std::unique_ptr<Chain::Lock> lock(bool try_lock) override
{
auto result = MakeUnique<LockImpl>(::cs_main, "cs_main", __FILE__, __LINE__, try_lock);
@@ -286,7 +288,7 @@ public:
}
bool broadcastTransaction(const CTransactionRef& tx, std::string& err_string, const CAmount& max_tx_fee, bool relay) override
{
- const TransactionError err = BroadcastTransaction(tx, err_string, max_tx_fee, relay, /*wait_callback*/ false);
+ const TransactionError err = BroadcastTransaction(m_node, tx, err_string, max_tx_fee, relay, /*wait_callback*/ false);
// Chain clients only care about failures to accept the tx to the mempool. Disregard non-mempool related failures.
// Note: this will need to be updated if BroadcastTransactions() is updated to return other non-mempool failures
// that Chain clients do not need to know about.
@@ -378,9 +380,10 @@ public:
notifications.TransactionAddedToMempool(entry.GetSharedTx());
}
}
+ NodeContext& m_node;
};
} // namespace
-std::unique_ptr<Chain> MakeChain() { return MakeUnique<ChainImpl>(); }
+std::unique_ptr<Chain> MakeChain(NodeContext& node) { return MakeUnique<ChainImpl>(node); }
} // namespace interfaces