aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
authorSjors Provoost <sjors@sprovoost.nl>2024-06-07 11:51:18 +0200
committerSjors Provoost <sjors@sprovoost.nl>2024-06-18 18:47:52 +0200
commitdda0b0834faf7be7e8938bf63e7bb01cd54a416a (patch)
treec63148232d2de5d4cb3a7b8125bdc952813a53d8 /src/interfaces
parent7b4d3249ced93ec5986500e43b324005ed89502f (diff)
rpc: minize getTipHash() calls in gbt
Set tip at the start of the function and only update it for a long poll. Additionally have getTipHash return an optional, so the caller can explicitly check that a tip exists.
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/mining.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/interfaces/mining.h b/src/interfaces/mining.h
index cd092397f3..6e47333fd5 100644
--- a/src/interfaces/mining.h
+++ b/src/interfaces/mining.h
@@ -5,6 +5,7 @@
#ifndef BITCOIN_INTERFACES_MINING_H
#define BITCOIN_INTERFACES_MINING_H
+#include <optional>
#include <uint256.h>
namespace node {
@@ -29,8 +30,8 @@ public:
//! If this chain is exclusively used for testing
virtual bool isTestChain() = 0;
- //! Returns the hash for the tip of this chain, 0 if none
- virtual uint256 getTipHash() = 0;
+ //! Returns the hash for the tip of this chain
+ virtual std::optional<uint256> getTipHash() = 0;
/**
* Construct a new block template