Skip to content

Commit 59d7345

Browse files
committed
Remove silly ActivateBestChains from net_processing - OVERKILL!
1 parent 5a7d13f commit 59d7345

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

src/net_processing.cpp

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,22 +1131,6 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
11311131
if (mi != mapBlockIndex.end()) {
11321132
if (mi->second->nChainWork >= (pindexBestHeader->pprev ? (pindexBestHeader->pprev->pprev ? pindexBestHeader->pprev->pprev->nChainWork : 0) : 0))
11331133
fRecent = true;
1134-
if (mi->second->nChainTx && !mi->second->IsValid(BLOCK_VALID_SCRIPTS) &&
1135-
mi->second->IsValid(BLOCK_VALID_TREE)) {
1136-
// If we have the block and all of its parents, but have not yet validated it,
1137-
// we might be in the middle of connecting it (ie in the unlock of cs_main
1138-
// before ActivateBestChain but after AcceptBlock).
1139-
// In this case, we need to run ActivateBestChain prior to checking the relay
1140-
// conditions below.
1141-
std::shared_ptr<const CBlock> a_recent_block;
1142-
{
1143-
LOCK(cs_most_recent_block);
1144-
a_recent_block = most_recent_block;
1145-
}
1146-
CValidationState dummy;
1147-
LogPrint("block", "recv getdata %s - Calling ActivateBestChain()\n", strBlockInfo(mi->second));
1148-
ActivateBestChain(dummy, Params(), a_recent_block);
1149-
}
11501134
if (chainActive.Contains(mi->second)) {
11511135
send = true;
11521136
} else {
@@ -1757,23 +1741,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
17571741
uint256 hashStop;
17581742
vRecv >> locator >> hashStop;
17591743

1760-
// We might have announced the currently-being-connected tip using a
1761-
// compact block, which resulted in the peer sending a getblocks
1762-
// request, which we would otherwise respond to without the new block.
1763-
// To avoid this situation we simply verify that we are on our best
1764-
// known chain now. This is super overkill, but we handle it better
1765-
// for getheaders requests, and there are no known nodes which support
1766-
// compact blocks but still use getblocks to request blocks.
1767-
{
1768-
std::shared_ptr<const CBlock> a_recent_block;
1769-
{
1770-
LOCK(cs_most_recent_block);
1771-
a_recent_block = most_recent_block;
1772-
}
1773-
CValidationState dummy;
1774-
ActivateBestChain(dummy, Params(), a_recent_block);
1775-
}
1776-
17771744
LOCK(cs_main);
17781745

17791746
// Find the last block the caller has in the main chain

0 commit comments

Comments
 (0)