diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2020-01-21 15:00:33 -0500 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2020-03-31 08:36:02 -0500 |
commit | f7ba881bc669451a60fedac58a449794702a3e23 (patch) | |
tree | c7a5782b68d6f6b71fb2da9ec94530cfaaa06deb /src/interfaces/chain.h | |
parent | bc96a9bfc61afdb696fb92cb644ed5fc3d1793f1 (diff) | |
download | bitcoin-f7ba881bc669451a60fedac58a449794702a3e23.tar.xz |
wallet: Avoid use of Chain::Lock in listsinceblock
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. Previously listsinceblock might not have returned
all transactions up to the claimed "lastblock" value in this case, resulting in
race conditions and potentially missing transactions in cases where
listsinceblock was called in a loop like
https://github.com/bitcoin/bitcoin/issues/14338#issuecomment-426706574
Diffstat (limited to 'src/interfaces/chain.h')
-rw-r--r-- | src/interfaces/chain.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h index 4c711a618d..ee79b3e6dc 100644 --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -146,12 +146,24 @@ public: //! or contents. virtual bool findBlock(const uint256& hash, const FoundBlock& block={}) = 0; + //! Find ancestor of block at specified height and optionally return + //! ancestor information. + virtual bool findAncestorByHeight(const uint256& block_hash, int ancestor_height, const FoundBlock& ancestor_out={}) = 0; + //! Return whether block descends from a specified ancestor, and //! optionally return ancestor information. virtual bool findAncestorByHash(const uint256& block_hash, const uint256& ancestor_hash, const FoundBlock& ancestor_out={}) = 0; + //! Find most recent common ancestor between two blocks and optionally + //! return block information. + virtual bool findCommonAncestor(const uint256& block_hash1, + const uint256& block_hash2, + const FoundBlock& ancestor_out={}, + const FoundBlock& block1_out={}, + const FoundBlock& block2_out={}) = 0; + //! Look up unspent output information. Returns coins in the mempool and in //! the current chain UTXO set. Iterates through all the keys in the map and //! populates the values. |