Merge a9d1b40d53 into merged_master (Bitcoin PR #21415)

This commit is contained in:
Andrew Poelstra 2021-06-27 15:02:35 +00:00
commit 26fd4eb181
51 changed files with 182 additions and 193 deletions

View file

@ -50,6 +50,7 @@
#endif
#include <memory>
#include <optional>
#include <utility>
using interfaces::BlockTip;
@ -415,7 +416,7 @@ class ChainImpl : public Chain
{
public:
explicit ChainImpl(NodeContext& node) : m_node(node) {}
Optional<int> getHeight() override
std::optional<int> getHeight() override
{
LOCK(::cs_main);
const CChain& active = Assert(m_node.chainman)->ActiveChain();
@ -423,7 +424,7 @@ public:
if (height >= 0) {
return height;
}
return nullopt;
return std::nullopt;
}
uint256 getBlockHash(int height) override
{
@ -452,7 +453,7 @@ public:
assert(std::addressof(::ChainActive()) == std::addressof(m_node.chainman->ActiveChain()));
return CheckFinalTx(m_node.chainman->ActiveChain().Tip(), tx);
}
Optional<int> findLocatorFork(const CBlockLocator& locator) override
std::optional<int> findLocatorFork(const CBlockLocator& locator) override
{
LOCK(cs_main);
const CChain& active = Assert(m_node.chainman)->ActiveChain();
@ -460,7 +461,7 @@ public:
if (CBlockIndex* fork = m_node.chainman->m_blockman.FindForkInGlobalIndex(active, locator)) {
return fork->nHeight;
}
return nullopt;
return std::nullopt;
}
bool findBlock(const uint256& hash, const FoundBlock& block) override
{
@ -518,7 +519,7 @@ public:
assert(std::addressof(g_chainman) == std::addressof(*m_node.chainman));
return GuessVerificationProgress(m_node.chainman->m_blockman.LookupBlockIndex(block_hash), Params().GetConsensus().nPowTargetSpacing);
}
bool hasBlocks(const uint256& block_hash, int min_height, Optional<int> max_height) override
bool hasBlocks(const uint256& block_hash, int min_height, std::optional<int> max_height) override
{
// hasBlocks returns true if all ancestors of block_hash in specified
// range have block data (are not pruned), false if any ancestors in