mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user