|
11 | 11 | #include <blockfilter.h>
|
12 | 12 | #include <chainparams.h>
|
13 | 13 | #include <consensus/validation.h>
|
| 14 | +#include <deploymentstatus.h> |
14 | 15 | #include <hash.h>
|
15 | 16 | #include <index/blockfilterindex.h>
|
16 | 17 | #include <merkleblock.h>
|
@@ -997,7 +998,7 @@ void PeerManagerImpl::FindNextBlocksToDownload(NodeId nodeid, unsigned int count
|
997 | 998 | // We consider the chain that this peer is on invalid.
|
998 | 999 | return;
|
999 | 1000 | }
|
1000 |
| - if (!State(nodeid)->fHaveWitness && IsWitnessEnabled(pindex->pprev, consensusParams)) { |
| 1001 | + if (!State(nodeid)->fHaveWitness && DeploymentActiveAt(*pindex, consensusParams, Consensus::DEPLOYMENT_SEGWIT)) { |
1001 | 1002 | // We wouldn't download this block or its descendants from this peer.
|
1002 | 1003 | return;
|
1003 | 1004 | }
|
@@ -1467,7 +1468,7 @@ void PeerManagerImpl::NewPoWValidBlock(const CBlockIndex *pindex, const std::sha
|
1467 | 1468 | return;
|
1468 | 1469 | nHighestFastAnnounce = pindex->nHeight;
|
1469 | 1470 |
|
1470 |
| - bool fWitnessEnabled = IsWitnessEnabled(pindex->pprev, m_chainparams.GetConsensus()); |
| 1471 | + bool fWitnessEnabled = DeploymentActiveAt(*pindex, m_chainparams.GetConsensus(), Consensus::DEPLOYMENT_SEGWIT); |
1471 | 1472 | uint256 hashBlock(pblock->GetHash());
|
1472 | 1473 |
|
1473 | 1474 | {
|
@@ -2082,7 +2083,7 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, const Peer& peer,
|
2082 | 2083 | while (pindexWalk && !m_chainman.ActiveChain().Contains(pindexWalk) && vToFetch.size() <= MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
|
2083 | 2084 | if (!(pindexWalk->nStatus & BLOCK_HAVE_DATA) &&
|
2084 | 2085 | !IsBlockRequested(pindexWalk->GetBlockHash()) &&
|
2085 |
| - (!IsWitnessEnabled(pindexWalk->pprev, m_chainparams.GetConsensus()) || State(pfrom.GetId())->fHaveWitness)) { |
| 2086 | + (!DeploymentActiveAt(*pindexWalk, m_chainparams.GetConsensus(), Consensus::DEPLOYMENT_SEGWIT) || State(pfrom.GetId())->fHaveWitness)) { |
2086 | 2087 | // We don't have this block, and it's not yet in flight.
|
2087 | 2088 | vToFetch.push_back(pindexWalk);
|
2088 | 2089 | }
|
@@ -3397,7 +3398,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
3397 | 3398 | return;
|
3398 | 3399 | }
|
3399 | 3400 |
|
3400 |
| - if (IsWitnessEnabled(pindex->pprev, m_chainparams.GetConsensus()) && !nodestate->fSupportsDesiredCmpctVersion) { |
| 3401 | + if (DeploymentActiveAt(*pindex, m_chainparams.GetConsensus(), Consensus::DEPLOYMENT_SEGWIT) && !nodestate->fSupportsDesiredCmpctVersion) { |
3401 | 3402 | // Don't bother trying to process compact blocks from v1 peers
|
3402 | 3403 | // after segwit activates.
|
3403 | 3404 | return;
|
|
0 commit comments