mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Merge #15931: Remove GetDepthInMainChain dependency on locked chain interface
36b68de5b2Remove getBlockDepth method from Chain::interface (Antoine Riard)b66c429c56Remove locked_chain from GetDepthInMainChain and its callers (Antoine Riard)0ff03871adUse CWallet::m_last_block_processed_height in GetDepthInMainChain (Antoine Riard)f77b1de16fOnly return early from BlockUntilSyncedToCurrentChain if current tip is exact match (Antoine Riard)769ff05e48Refactor some importprunedfunds checks with guard clause (Antoine Riard)5971d3848eAdd block_height field in struct Confirmation (Antoine Riard)9700fcb47fReplace CWalletTx::SetConf by Confirmation initialization list (Antoine Riard)5aacc3eff1Add m_last_block_processed_height field in CWallet (Antoine Riard)10b4729e33Pass block height in Chain::BlockConnected/Chain::BlockDisconnected (Antoine Riard) Pull request description: Work starter to remove Chain::Lock interface by adding m_last_block_processed_height in CWallet and m_block_height in CMerkleTx to avoid GetDepthInMainChain having to keep a lock . Once this one done, it should ease work to wipe out more cs_main locks from wallet code. I think it's ready for a first round of review before to get further. - `BlockUntilSyncedToCurrent` : restrain isPotentialTip to isTip because we want to be sure that wallet see BlockDisconnected callbacks if its height differs from the Chain one. It means during a reorg, an RPC could return before the BlockDisconnected callback had been triggered. This could cause a tx that had been included in the disconnected block to be displayed as confirmed, for example. ~~- `AbandonTransaction` : in case of conflicted tx (nIndex = -1), we set its m_block_height to the one of conflicting blocks, but if this height is superior to CWallet::m_last_block_processed_height, that means tx isn't conflicted anymore so we return 0 as tx is again unconfirmed~~ After #16624, we instead rely on Confirmation. ~~- `AddToWalletIfInvolvingMe`: in case of block disconnected, transactions are added to mempool again, so we need to replace old txn in `mapWallet` with a height set to zero so we remove check on block_hash.IsNull~~ Already done in #16624 ACKs for top commit: jnewbery: @jkczyz you've ACKed an intermediate commit (github annoyingly orders commits in date order, not commit order). Did you mean to ACK the final commit in this branch (36b68de5b2). jkczyz: > @jkczyz you've ACKed an intermediate commit (github annoyingly orders commits in date order, not commit order). Did you mean to ACK the final commit in this branch ([36b68de](36b68de5b2)). meshcollider: utACK36b68de5b2ryanofsky: Code review ACK36b68de5b2. Changes since last review: new jkczyz refactor importprunedfunds commit, changed BlockUntilSyncedToCurrentChainChanges commit title and description, changed Confirmation struct field order and line-wrapped comment jnewbery: utACK36b68de5b2promag: Code review ACK36b68de5b2. Tree-SHA512: 08b89a0bcc39f67c82a6cb6aee195e6a11697770c788ba737b90986b4893f44e90d1ab9ef87239ea3766508b7e24ea882b7199df41173ab27a3d000328c14644
This commit is contained in:
@@ -40,9 +40,10 @@ struct TestSubscriber : public CValidationInterface {
|
||||
m_expected_tip = block->GetHash();
|
||||
}
|
||||
|
||||
void BlockDisconnected(const std::shared_ptr<const CBlock>& block) override
|
||||
void BlockDisconnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* pindex) override
|
||||
{
|
||||
BOOST_CHECK_EQUAL(m_expected_tip, block->GetHash());
|
||||
BOOST_CHECK_EQUAL(m_expected_tip, pindex->GetBlockHash());
|
||||
|
||||
m_expected_tip = block->hashPrevBlock;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user