mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-23 13:29:43 +02:00
Introduce Mining interface
Start out with a single method isTestChain() that's used by the getblocktemplate RPC.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <interfaces/chain.h>
|
||||
#include <interfaces/echo.h>
|
||||
#include <interfaces/mining.h>
|
||||
#include <interfaces/node.h>
|
||||
#include <interfaces/wallet.h>
|
||||
|
||||
@@ -32,6 +33,7 @@ public:
|
||||
virtual ~Init() = default;
|
||||
virtual std::unique_ptr<Node> makeNode() { return nullptr; }
|
||||
virtual std::unique_ptr<Chain> makeChain() { return nullptr; }
|
||||
virtual std::unique_ptr<Mining> makeMining() { return nullptr; }
|
||||
virtual std::unique_ptr<WalletLoader> makeWalletLoader(Chain& chain) { return nullptr; }
|
||||
virtual std::unique_ptr<Echo> makeEcho() { return nullptr; }
|
||||
virtual Ipc* ipc() { return nullptr; }
|
||||
|
||||
35
src/interfaces/mining.h
Normal file
35
src/interfaces/mining.h
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user