diff options
| author | Russell Yanofsky <[email protected]> | 2020-01-16 16:38:30 -0500 |
|---|---|---|
| committer | Russell Yanofsky <[email protected]> | 2020-03-31 08:36:02 -0500 |
| commit | c1694ce6bb7e19a8722d5583cd85ad17da40bb67 (patch) | |
| tree | 21e0b8bdd3d8cba56623e3f63696f31a9d6a6517 /src/interfaces/chain.cpp | |
| parent | wallet refactor: Avoid use of Chain::Lock in qt wallettests (diff) | |
| download | discoin-c1694ce6bb7e19a8722d5583cd85ad17da40bb67.tar.xz discoin-c1694ce6bb7e19a8722d5583cd85ad17da40bb67.zip | |
wallet: Avoid use of Chain::Lock in importprunedfunds
This is a step toward removing the Chain::Lock class and reducing cs_main
locking.
This change only affects behavior in the case where wallet last block processed
falls behind the chain tip, in which case the "Block not found in chain" error
will be stricter and not allow importing data from a blocks between the wallet
last processed tip and the current node tip.
Diffstat (limited to 'src/interfaces/chain.cpp')
| -rw-r--r-- | src/interfaces/chain.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp index cfaf79f70..1c1fbe738 100644 --- a/src/interfaces/chain.cpp +++ b/src/interfaces/chain.cpp @@ -267,6 +267,14 @@ public: WAIT_LOCK(cs_main, lock); return FillBlock(LookupBlockIndex(hash), block, lock); } + bool findAncestorByHash(const uint256& block_hash, const uint256& ancestor_hash, const FoundBlock& ancestor_out) override + { + WAIT_LOCK(cs_main, lock); + const CBlockIndex* block = LookupBlockIndex(block_hash); + const CBlockIndex* ancestor = LookupBlockIndex(ancestor_hash); + if (block && ancestor && block->GetAncestor(ancestor->nHeight) != ancestor) ancestor = nullptr; + return FillBlock(ancestor, ancestor_out, lock); + } void findCoins(std::map<COutPoint, Coin>& coins) override { return FindCoins(m_node, coins); } double guessVerificationProgress(const uint256& block_hash) override { |