@@ -2308,9 +2308,9 @@ void PeerManagerImpl::ProcessGetBlockData(CNode& pfrom, Peer& peer, const CInv&
2308
2308
}
2309
2309
if (pblock) {
2310
2310
if (inv.IsMsgBlk ()) {
2311
- m_connman.PushMessage (&pfrom, msgMaker.Make (SERIALIZE_TRANSACTION_NO_WITNESS, NetMsgType::BLOCK, *pblock));
2311
+ m_connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::BLOCK, TX_NO_WITNESS ( *pblock) ));
2312
2312
} else if (inv.IsMsgWitnessBlk ()) {
2313
- m_connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::BLOCK, *pblock));
2313
+ m_connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::BLOCK, TX_WITH_WITNESS ( *pblock) ));
2314
2314
} else if (inv.IsMsgFilteredBlk ()) {
2315
2315
bool sendMerkleBlock = false ;
2316
2316
CMerkleBlock merkleBlock;
@@ -2331,7 +2331,7 @@ void PeerManagerImpl::ProcessGetBlockData(CNode& pfrom, Peer& peer, const CInv&
2331
2331
// however we MUST always provide at least what the remote peer needs
2332
2332
typedef std::pair<unsigned int , uint256> PairType;
2333
2333
for (PairType& pair : merkleBlock.vMatchedTxn )
2334
- m_connman.PushMessage (&pfrom, msgMaker.Make (SERIALIZE_TRANSACTION_NO_WITNESS, NetMsgType::TX, *pblock->vtx [pair.first ]));
2334
+ m_connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::TX, TX_NO_WITNESS ( *pblock->vtx [pair.first ]) ));
2335
2335
}
2336
2336
// else
2337
2337
// no response
@@ -2348,7 +2348,7 @@ void PeerManagerImpl::ProcessGetBlockData(CNode& pfrom, Peer& peer, const CInv&
2348
2348
m_connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::CMPCTBLOCK, cmpctblock));
2349
2349
}
2350
2350
} else {
2351
- m_connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::BLOCK, *pblock));
2351
+ m_connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::BLOCK, TX_WITH_WITNESS ( *pblock) ));
2352
2352
}
2353
2353
}
2354
2354
}
@@ -2418,8 +2418,8 @@ void PeerManagerImpl::ProcessGetData(CNode& pfrom, Peer& peer, const std::atomic
2418
2418
CTransactionRef tx = FindTxForGetData (*tx_relay, ToGenTxid (inv));
2419
2419
if (tx) {
2420
2420
// WTX and WITNESS_TX imply we serialize with witness
2421
- int nSendFlags = (inv.IsMsgTx () ? SERIALIZE_TRANSACTION_NO_WITNESS : 0 );
2422
- m_connman.PushMessage (&pfrom, msgMaker.Make (nSendFlags, NetMsgType::TX, *tx));
2421
+ const auto maybe_with_witness = (inv.IsMsgTx () ? TX_NO_WITNESS : TX_WITH_WITNESS );
2422
+ m_connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::TX, maybe_with_witness ( *tx) ));
2423
2423
m_mempool.RemoveUnbroadcastTx (tx->GetHash ());
2424
2424
} else {
2425
2425
vNotFound.push_back (inv);
@@ -4119,7 +4119,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4119
4119
LogPrint (BCLog::NET, " Ignoring getheaders from peer=%d because active chain has too little work; sending empty response\n " , pfrom.GetId ());
4120
4120
// Just respond with an empty headers message, to tell the peer to
4121
4121
// go away but not treat us as unresponsive.
4122
- m_connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::HEADERS, std::vector<CBlock >()));
4122
+ m_connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::HEADERS, std::vector<CBlockHeader >()));
4123
4123
return ;
4124
4124
}
4125
4125
@@ -4169,7 +4169,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4169
4169
// will re-announce the new block via headers (or compact blocks again)
4170
4170
// in the SendMessages logic.
4171
4171
nodestate->pindexBestHeaderSent = pindex ? pindex : m_chainman.ActiveChain ().Tip ();
4172
- m_connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::HEADERS, vHeaders));
4172
+ m_connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::HEADERS, TX_WITH_WITNESS ( vHeaders) ));
4173
4173
return ;
4174
4174
}
4175
4175
@@ -4186,7 +4186,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4186
4186
if (m_chainman.IsInitialBlockDownload ()) return ;
4187
4187
4188
4188
CTransactionRef ptx;
4189
- vRecv >> ptx;
4189
+ vRecv >> TX_WITH_WITNESS ( ptx) ;
4190
4190
const CTransaction& tx = *ptx;
4191
4191
4192
4192
const uint256& txid = ptx->GetHash ();
@@ -4687,7 +4687,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4687
4687
}
4688
4688
4689
4689
std::shared_ptr<CBlock> pblock = std::make_shared<CBlock>();
4690
- vRecv >> *pblock;
4690
+ vRecv >> TX_WITH_WITNESS ( *pblock) ;
4691
4691
4692
4692
LogPrint (BCLog::NET, " received block %s peer=%d\n " , pblock->GetHash ().ToString (), pfrom.GetId ());
4693
4693
@@ -5698,7 +5698,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
5698
5698
LogPrint (BCLog::NET, " %s: sending header %s to peer=%d\n " , __func__,
5699
5699
vHeaders.front ().GetHash ().ToString (), pto->GetId ());
5700
5700
}
5701
- m_connman.PushMessage (pto, msgMaker.Make (NetMsgType::HEADERS, vHeaders));
5701
+ m_connman.PushMessage (pto, msgMaker.Make (NetMsgType::HEADERS, TX_WITH_WITNESS ( vHeaders) ));
5702
5702
state.pindexBestHeaderSent = pBestIndex;
5703
5703
} else
5704
5704
fRevertToInv = true ;
0 commit comments