diff options
author | Sjors Provoost <sjors@sprovoost.nl> | 2024-06-07 11:51:18 +0200 |
---|---|---|
committer | Sjors Provoost <sjors@sprovoost.nl> | 2024-06-18 18:47:52 +0200 |
commit | dda0b0834faf7be7e8938bf63e7bb01cd54a416a (patch) | |
tree | c63148232d2de5d4cb3a7b8125bdc952813a53d8 /src/node | |
parent | 7b4d3249ced93ec5986500e43b324005ed89502f (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/node')
-rw-r--r-- | src/node/interfaces.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index 2633ff1b98..68c1c598cd 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -847,11 +847,11 @@ public: return chainman().GetParams().IsTestChain(); } - uint256 getTipHash() override + std::optional<uint256> getTipHash() override { LOCK(::cs_main); CBlockIndex* tip{chainman().ActiveChain().Tip()}; - if (!tip) return uint256{0}; + if (!tip) return {}; return tip->GetBlockHash(); } |