aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/node.h
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2020-05-28 16:35:15 -0400
committerRussell Yanofsky <russ@yanofsky.org>2020-07-13 04:34:27 -0400
commitedc316020e8270dafc5e31465d532baebdafd3dd (patch)
tree184b66559d810a0e84ee81146e921d5450cad298 /src/interfaces/node.h
parentd52bfc49161721fd55b9312549b3da674da387fe (diff)
downloadbitcoin-edc316020e8270dafc5e31465d532baebdafd3dd.tar.xz
test: Remove duplicate NodeContext hacks
Qt tests currently are currently using two NodeContext structs at the same time, one in interfaces::NodeImpl::m_context, and the other in BasicTestingSetup::m_node, and the tests have hacks transferring state between them. Fix this by getting rid of the NodeImpl::m_context struct and making it a pointer. This way a common BitcoinApplication object can be used for all qt tests, but they can still have their own testing setups. Non-test code is changing but non-test behavior is still the same as before. Motivation for this PR is to be able to remove the "std::move(test.m_node.connman)" and mempool hacks for swapping individual NodeContext members in Qt tests, because followup PR #19099 adds yet another member (wallet_client) that needs to be swapped. After this change, the whole NodeContext struct can be swapped instead of individual members, so the workarounds are less fragile and invasive.
Diffstat (limited to 'src/interfaces/node.h')
-rw-r--r--src/interfaces/node.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/interfaces/node.h b/src/interfaces/node.h
index b88b5bc14e..491795b072 100644
--- a/src/interfaces/node.h
+++ b/src/interfaces/node.h
@@ -263,12 +263,14 @@ public:
std::function<void(SynchronizationState, interfaces::BlockTip tip, double verification_progress)>;
virtual std::unique_ptr<Handler> handleNotifyHeaderTip(NotifyHeaderTipFn fn) = 0;
- //! Return pointer to internal chain interface, useful for testing.
+ //! Get and set internal node context. Useful for testing, but not
+ //! accessible across processes.
virtual NodeContext* context() { return nullptr; }
+ virtual void setContext(NodeContext* context) { }
};
//! Return implementation of Node interface.
-std::unique_ptr<Node> MakeNode();
+std::unique_ptr<Node> MakeNode(NodeContext* context = nullptr);
//! Block tip (could be a header or not, depends on the subscribed signal).
struct BlockTip {