aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/mining.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/mining.h')
-rw-r--r--src/interfaces/mining.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/interfaces/mining.h b/src/interfaces/mining.h
new file mode 100644
index 0000000000..afcd8d1cda
--- /dev/null
+++ b/src/interfaces/mining.h
@@ -0,0 +1,35 @@
+// Copyright (c) 2024 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#ifndef BITCOIN_INTERFACES_MINING_H
+#define BITCOIN_INTERFACES_MINING_H
+
+namespace node {
+struct NodeContext;
+} // namespace node
+
+namespace interfaces {
+
+//! Interface giving clients (RPC, Stratum v2 Template Provider in the future)
+//! ability to create block templates.
+
+class Mining
+{
+public:
+ virtual ~Mining() {}
+
+ //! If this chain is exclusively used for testing
+ virtual bool isTestChain() = 0;
+
+ //! Get internal node context. Useful for RPC and testing,
+ //! but not accessible across processes.
+ virtual node::NodeContext* context() { return nullptr; }
+};
+
+//! Return implementation of Mining interface.
+std::unique_ptr<Mining> MakeMining(node::NodeContext& node);
+
+} // namespace interfaces
+
+#endif // BITCOIN_INTERFACES_MINING_H