aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/mining.h
diff options
context:
space:
mode:
authorSjors Provoost <sjors@sprovoost.nl>2024-06-10 17:58:13 +0200
committerSjors Provoost <sjors@sprovoost.nl>2024-06-18 18:47:51 +0200
commitd8a3496b5ad27bea4c79ea0344f595cc1b95f0d3 (patch)
tree0aac30137fb85c4fd26398c43f4b2da75002cdc9 /src/interfaces/mining.h
parent8ecb6816781c7c7f423b501cbb2de3abd7250119 (diff)
rpc: call TestBlockValidity via miner interface
Diffstat (limited to 'src/interfaces/mining.h')
-rw-r--r--src/interfaces/mining.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/interfaces/mining.h b/src/interfaces/mining.h
index afcd8d1cda..603d8475d3 100644
--- a/src/interfaces/mining.h
+++ b/src/interfaces/mining.h
@@ -9,6 +9,9 @@ namespace node {
struct NodeContext;
} // namespace node
+class BlockValidationState;
+class CBlock;
+
namespace interfaces {
//! Interface giving clients (RPC, Stratum v2 Template Provider in the future)
@@ -22,6 +25,18 @@ public:
//! If this chain is exclusively used for testing
virtual bool isTestChain() = 0;
+ /**
+ * Check a block is completely valid from start to finish.
+ * Only works on top of our current best block.
+ * Does not check proof-of-work.
+ *
+ * @param[out] state details of why a block failed to validate
+ * @param[in] block the block to validate
+ * @param[in] check_merkle_root call CheckMerkleRoot()
+ * @returns false if any of the checks fail
+ */
+ virtual bool testBlockValidity(BlockValidationState& state, const CBlock& block, bool check_merkle_root = true) = 0;
+
//! Get internal node context. Useful for RPC and testing,
//! but not accessible across processes.
virtual node::NodeContext* context() { return nullptr; }