@@ -1654,8 +1654,7 @@ void PeerManagerImpl::NewPoWValidBlock(const CBlockIndex *pindex, const std::sha
1654
1654
CNodeState &state = *State (pnode->GetId ());
1655
1655
// If the peer has, or we announced to them the previous block already,
1656
1656
// but we don't think they have this one, go ahead and announce it
1657
- if (state.fPreferHeaderAndIDs && (!fWitnessEnabled || state.fProvidesHeaderAndIDs ) &&
1658
- !PeerHasHeader (&state, pindex) && PeerHasHeader (&state, pindex->pprev )) {
1657
+ if (state.fPreferHeaderAndIDs && !PeerHasHeader (&state, pindex) && PeerHasHeader (&state, pindex->pprev )) {
1659
1658
1660
1659
LogPrint (BCLog::NET, " %s sending header-and-ids %s to peer=%d\n " , " PeerManager::NewPoWValidBlock" ,
1661
1660
hashBlock.ToString (), pnode->GetId ());
@@ -4767,27 +4766,20 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
4767
4766
LogPrint (BCLog::NET, " %s sending header-and-ids %s to peer=%d\n " , __func__,
4768
4767
vHeaders.front ().GetHash ().ToString (), pto->GetId ());
4769
4768
4770
- int nSendFlags = state.fProvidesHeaderAndIDs ? 0 : SERIALIZE_TRANSACTION_NO_WITNESS;
4771
-
4772
4769
bool fGotBlockFromCache = false ;
4773
4770
{
4774
4771
LOCK (m_most_recent_block_mutex);
4775
4772
if (m_most_recent_block_hash == pBestIndex->GetBlockHash ()) {
4776
- if (state.fProvidesHeaderAndIDs || !m_most_recent_compact_block_has_witnesses)
4777
- m_connman.PushMessage (pto, msgMaker.Make (nSendFlags, NetMsgType::CMPCTBLOCK, *m_most_recent_compact_block));
4778
- else {
4779
- CBlockHeaderAndShortTxIDs cmpctblock (*m_most_recent_block, state.fProvidesHeaderAndIDs );
4780
- m_connman.PushMessage (pto, msgMaker.Make (nSendFlags, NetMsgType::CMPCTBLOCK, cmpctblock));
4781
- }
4773
+ m_connman.PushMessage (pto, msgMaker.Make (NetMsgType::CMPCTBLOCK, *m_most_recent_compact_block));
4782
4774
fGotBlockFromCache = true ;
4783
4775
}
4784
4776
}
4785
4777
if (!fGotBlockFromCache ) {
4786
4778
CBlock block;
4787
4779
bool ret = ReadBlockFromDisk (block, pBestIndex, consensusParams);
4788
4780
assert (ret);
4789
- CBlockHeaderAndShortTxIDs cmpctblock (block, state. fProvidesHeaderAndIDs );
4790
- m_connman.PushMessage (pto, msgMaker.Make (nSendFlags, NetMsgType::CMPCTBLOCK, cmpctblock));
4781
+ CBlockHeaderAndShortTxIDs cmpctblock (block, true );
4782
+ m_connman.PushMessage (pto, msgMaker.Make (NetMsgType::CMPCTBLOCK, cmpctblock));
4791
4783
}
4792
4784
state.pindexBestHeaderSent = pBestIndex;
4793
4785
} else if (state.fPreferHeaders ) {
0 commit comments