|
11 | 11 | #include <net.h> |
12 | 12 | #include <net_processing.h> |
13 | 13 | #include <node/coin.h> |
| 14 | +#include <node/context.h> |
14 | 15 | #include <node/transaction.h> |
15 | 16 | #include <policy/fees.h> |
16 | 17 | #include <policy/policy.h> |
@@ -238,6 +239,7 @@ class RpcHandlerImpl : public Handler |
238 | 239 | class ChainImpl : public Chain |
239 | 240 | { |
240 | 241 | public: |
| 242 | + explicit ChainImpl(NodeContext& node) : m_node(node) {} |
241 | 243 | std::unique_ptr<Chain::Lock> lock(bool try_lock) override |
242 | 244 | { |
243 | 245 | auto result = MakeUnique<LockImpl>(::cs_main, "cs_main", __FILE__, __LINE__, try_lock); |
@@ -286,7 +288,7 @@ class ChainImpl : public Chain |
286 | 288 | } |
287 | 289 | bool broadcastTransaction(const CTransactionRef& tx, std::string& err_string, const CAmount& max_tx_fee, bool relay) override |
288 | 290 | { |
289 | | - const TransactionError err = BroadcastTransaction(tx, err_string, max_tx_fee, relay, /*wait_callback*/ false); |
| 291 | + const TransactionError err = BroadcastTransaction(m_node, tx, err_string, max_tx_fee, relay, /*wait_callback*/ false); |
290 | 292 | // Chain clients only care about failures to accept the tx to the mempool. Disregard non-mempool related failures. |
291 | 293 | // Note: this will need to be updated if BroadcastTransactions() is updated to return other non-mempool failures |
292 | 294 | // that Chain clients do not need to know about. |
@@ -378,9 +380,10 @@ class ChainImpl : public Chain |
378 | 380 | notifications.TransactionAddedToMempool(entry.GetSharedTx()); |
379 | 381 | } |
380 | 382 | } |
| 383 | + NodeContext& m_node; |
381 | 384 | }; |
382 | 385 | } // namespace |
383 | 386 |
|
384 | | -std::unique_ptr<Chain> MakeChain() { return MakeUnique<ChainImpl>(); } |
| 387 | +std::unique_ptr<Chain> MakeChain(NodeContext& node) { return MakeUnique<ChainImpl>(node); } |
385 | 388 |
|
386 | 389 | } // namespace interfaces |
0 commit comments