Skip to content

Commit 26d477b

Browse files
kwvgPastaPastaPasta
authored andcommitted
revert: Fix duplicate initial headers sync
commits reverted: - 753ed61
1 parent abccb2d commit 26d477b

File tree

3 files changed

+4
-29
lines changed

3 files changed

+4
-29
lines changed

src/net_processing.cpp

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3806,30 +3806,7 @@ void PeerManagerImpl::ProcessMessage(
38063806
statsClient.inc(strprintf("message.received.inv_%s", inv.GetCommand()), 1.0f);
38073807

38083808
UpdateBlockAvailability(pfrom.GetId(), inv.hash);
3809-
3810-
if (fAlreadyHave || fImporting || fReindex || mapBlocksInFlight.count(inv.hash)) {
3811-
continue;
3812-
}
3813-
3814-
CNodeState *state = State(pfrom.GetId());
3815-
if (!state) {
3816-
continue;
3817-
}
3818-
3819-
// Download if this is a nice peer, or we have no nice peers and this one might do.
3820-
bool fFetch = state->fPreferredDownload || (nPreferredDownload == 0 && !pfrom.IsAddrFetchConn());
3821-
// Only actively request headers from a single peer, unless we're close to end of initial download.
3822-
if ((nSyncStarted == 0 && fFetch) || m_chainman.m_best_header->GetBlockTime() > GetAdjustedTime() - nMaxTipAge) {
3823-
// Make sure to mark this peer as the one we are currently syncing with etc.
3824-
state->fSyncStarted = true;
3825-
state->m_headers_sync_timeout = current_time + HEADERS_DOWNLOAD_TIMEOUT_BASE +
3826-
(
3827-
// Convert HEADERS_DOWNLOAD_TIMEOUT_PER_HEADER to microseconds before scaling
3828-
// to maintain precision
3829-
std::chrono::microseconds{HEADERS_DOWNLOAD_TIMEOUT_PER_HEADER} *
3830-
(GetAdjustedTime() - m_chainman.m_best_header->GetBlockTime()) / m_chainparams.GetConsensus().nPowTargetSpacing
3831-
);
3832-
nSyncStarted++;
3809+
if (!fAlreadyHave && !fImporting && !fReindex && !mapBlocksInFlight.count(inv.hash)) {
38333810
// Headers-first is the primary method of announcement on
38343811
// the network. If a node fell back to sending blocks by inv,
38353812
// it's probably for a re-org. The final block hash

test/functional/feature_csv_activation.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,10 @@ class BIP68_112_113Test(BitcoinTestFramework):
9191
def set_test_params(self):
9292
self.num_nodes = 1
9393
self.setup_clean_chain = True
94-
# Must also set '-maxtipage=600100' to allow syncing from very old blocks
95-
# and '-dip3params=2000:2000' to create pre-dip3 blocks only
94+
# Must set '-dip3params=2000:2000' to create pre-dip3 blocks only
9695
self.extra_args = [[
9796
98-
'-maxtipage=600100', '-dip3params=2000:2000',
97+
'-dip3params=2000:2000',
9998
'-par=1', # Use only one script thread to get the exact reject reason for testing
10099
]]
101100
self.supports_cli = False

test/functional/feature_maxuploadtarget.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def set_test_params(self):
3838
self.extra_args = [[
3939
"-maxuploadtarget=200",
4040
"-blockmaxsize=999000",
41-
"-maxtipage="+str(2*60*60*24*7),
4241
"-acceptnonstdtxn=1"
4342
]]
4443
self.supports_cli = False
@@ -149,7 +148,7 @@ def run_test(self):
149148
self.nodes[0].disconnect_p2ps()
150149

151150
self.log.info("Restarting node 0 with download permission and 1MB maxuploadtarget")
152-
self.restart_node(0, ["[email protected]", "-maxuploadtarget=1", "-blockmaxsize=999000", "-maxtipage="+str(2*60*60*24*7), "-mocktime="+str(current_mocktime)])
151+
self.restart_node(0, ["[email protected]", "-maxuploadtarget=1", "-blockmaxsize=999000", "-mocktime="+str(current_mocktime)])
153152

154153
# Reconnect to self.nodes[0]
155154
peer = self.nodes[0].add_p2p_connection(TestP2PConn())

0 commit comments

Comments
 (0)