Nice point, I think it makes sense to not let ProcessCompactBlockTxns
check if we received blocktxn
while importing, we can leave it for ProcessMessage
. E.g.:
0@@ -3153,12 +3153,6 @@ void PeerManagerImpl::ProcessBlock(CNode& node, const std::shared_ptr<const CBlo
1 void PeerManagerImpl::ProcessCompactBlockTxns(CNode& pfrom, BlockTransactions& block_transactions, Peer& peer,
2 const CNetMsgMaker& msg_maker)
3 {
4- // Ignore blocktxn received while importing
5- if (fImporting || fReindex) {
6- LogPrint(BCLog::NET, "Unexpected blocktxn message received from peer %d\n", pfrom.GetId());
7- return;
8- }
9-
10 std::shared_ptr<CBlock> pblock = std::make_shared<CBlock>();
11 bool fBlockRead = false;
12 {
13@@ -4460,6 +4454,10 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
14
15 if (msg_type == NetMsgType::BLOCKTXN)
16 {
17+ if (fImporting || fReindex) {
18+ LogPrint(BCLog::NET, "Unexpected blocktxn message received from peer %d\n", pfrom.GetId());
19+ return;
20+ }
21 BlockTransactions resp;
22 vRecv >> resp;