diff options
author | Greg Sanders <gsanders87@gmail.com> | 2024-02-29 16:38:58 -0500 |
---|---|---|
committer | Greg Sanders <gsanders87@gmail.com> | 2024-02-29 16:38:58 -0500 |
commit | a1fbde0ef7cf6c94d4a5181f8ceb327096713160 (patch) | |
tree | c10b778676f59b50758acd30f3f93f3521b918be /src/net_processing.cpp | |
parent | 22a5ccfb06429c3b0e111a191e7ba71d98a1d198 (diff) | |
download | bitcoin-a1fbde0ef7cf6c94d4a5181f8ceb327096713160.tar.xz |
p2p: Don't consider blocks mutated if they don't connect to known prev block
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 5c3ec5f700..99ae0e8fa1 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -4721,7 +4721,8 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, const CBlockIndex* prev_block{WITH_LOCK(m_chainman.GetMutex(), return m_chainman.m_blockman.LookupBlockIndex(pblock->hashPrevBlock))}; - if (IsBlockMutated(/*block=*/*pblock, + // Check for possible mutation if it connects to something we know so we can check for DEPLOYMENT_SEGWIT being active + if (prev_block && IsBlockMutated(/*block=*/*pblock, /*check_witness_root=*/DeploymentActiveAfter(prev_block, m_chainman, Consensus::DEPLOYMENT_SEGWIT))) { LogDebug(BCLog::NET, "Received mutated block from peer=%d\n", peer->m_id); Misbehaving(*peer, 100, "mutated block"); |