aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/node.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/node.h')
-rw-r--r--src/interfaces/node.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/interfaces/node.h b/src/interfaces/node.h
index b88b5bc14e..753f3e6b13 100644
--- a/src/interfaces/node.h
+++ b/src/interfaces/node.h
@@ -39,6 +39,16 @@ class Handler;
class Wallet;
struct BlockTip;
+//! Block and header tip information
+struct BlockAndHeaderTipInfo
+{
+ int block_height;
+ int64_t block_time;
+ int header_height;
+ int64_t header_time;
+ double verification_progress;
+};
+
//! Top-level interface for a bitcoin node (bitcoind process).
class Node
{
@@ -66,6 +76,11 @@ public:
//! Choose network parameters.
virtual void selectParams(const std::string& network) = 0;
+ //! Read and update <datadir>/settings.json file with saved settings. This
+ //! needs to be called after selectParams() because the settings file
+ //! location is network-specific.
+ virtual bool initSettings(std::string& error) = 0;
+
//! Get the (assumed) blockchain size.
virtual uint64_t getAssumedBlockchainSize() = 0;
@@ -91,7 +106,7 @@ public:
virtual bool baseInitialize() = 0;
//! Start node.
- virtual bool appInitMain() = 0;
+ virtual bool appInitMain(interfaces::BlockAndHeaderTipInfo* tip_info = nullptr) = 0;
//! Stop node.
virtual void appShutdown() = 0;
@@ -263,12 +278,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 {