mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-31 16:24:48 +02:00
Introduce Mining interface
Start out with a single method isTestChain() that's used by the getblocktemplate RPC.
This commit is contained in:
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