mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
Merge bitcoin/bitcoin#29996: Assumeutxo: bugfix on loadtxoutset with a divergent chain + test
5b7f70ba26test: loadtxoutset in divergent chain with less work (Alfonso Roman Zubeldia)d35efe1efcp2p: Start downloading historical blocks from common ancestor (Martin Zumsande) Pull request description: This PR adds a test to cover the scenario of loading an assumeutxo snapshot when the current chain tip is not an ancestor of the snapshot block but has less work. During the review process, a bug was discovered where blocks between the last common ancestor and the background tip were not being requested if the background tip was not an ancestor of the snapshot block. mzumsande suggested a fix (65343ec49a6b73c4197dfc38e1c2f433b0a3838a) to start downloading historical blocks from the last common ancestor to address this issue. This fix has been incorporated into the PR with a slight modification. Related to https://github.com/bitcoin/bitcoin/issues/28648 ACKs for top commit: fjahr: tACK5b7f70ba26achow101: ACK5b7f70ba26mzumsande: Code Review ACK5b7f70ba26Tree-SHA512: f8957349686a6a1292165ea9e0fd8c912d21466072632a10f8ef9d852a5f430bc6b2a531e6884a4dbf2e3adb28b3d512b25919e78f5804a67320ef54c3b1aaf6
This commit is contained in:
@@ -6244,10 +6244,13 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
|
||||
// before the background chainstate to prioritize getting to network tip.
|
||||
FindNextBlocksToDownload(*peer, get_inflight_budget(), vToDownload, staller);
|
||||
if (m_chainman.BackgroundSyncInProgress() && !IsLimitedPeer(*peer)) {
|
||||
// If the background tip is not an ancestor of the snapshot block,
|
||||
// we need to start requesting blocks from their last common ancestor.
|
||||
const CBlockIndex *from_tip = LastCommonAncestor(m_chainman.GetBackgroundSyncTip(), m_chainman.GetSnapshotBaseBlock());
|
||||
TryDownloadingHistoricalBlocks(
|
||||
*peer,
|
||||
get_inflight_budget(),
|
||||
vToDownload, m_chainman.GetBackgroundSyncTip(),
|
||||
vToDownload, from_tip,
|
||||
Assert(m_chainman.GetSnapshotBaseBlock()));
|
||||
}
|
||||
for (const CBlockIndex *pindex : vToDownload) {
|
||||
|
||||
Reference in New Issue
Block a user