@@ -4190,6 +4190,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4190
4190
vRecv >> cmpctblock;
4191
4191
4192
4192
bool received_new_header = false ;
4193
+ const auto blockhash = cmpctblock.header .GetHash ();
4193
4194
4194
4195
{
4195
4196
LOCK (cs_main);
@@ -4207,7 +4208,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4207
4208
return ;
4208
4209
}
4209
4210
4210
- if (!m_chainman.m_blockman .LookupBlockIndex (cmpctblock. header . GetHash () )) {
4211
+ if (!m_chainman.m_blockman .LookupBlockIndex (blockhash )) {
4211
4212
received_new_header = true ;
4212
4213
}
4213
4214
}
@@ -4221,6 +4222,11 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4221
4222
}
4222
4223
}
4223
4224
4225
+ if (received_new_header) {
4226
+ LogPrintfCategory (BCLog::NET, " Saw new cmpctblock header hash=%s peer=%d\n " ,
4227
+ blockhash.ToString (), pfrom.GetId ());
4228
+ }
4229
+
4224
4230
// When we succeed in decoding a block's txids from a cmpctblock
4225
4231
// message we typically jump to the BLOCKTXN handling code, with a
4226
4232
// dummy (empty) BLOCKTXN message, to re-use the logic there in
@@ -4263,7 +4269,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4263
4269
// We requested this block for some reason, but our mempool will probably be useless
4264
4270
// so we just grab the block via normal getdata
4265
4271
std::vector<CInv> vInv (1 );
4266
- vInv[0 ] = CInv (MSG_BLOCK | GetFetchFlags (*peer), cmpctblock. header . GetHash () );
4272
+ vInv[0 ] = CInv (MSG_BLOCK | GetFetchFlags (*peer), blockhash );
4267
4273
m_connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::GETDATA, vInv));
4268
4274
}
4269
4275
return ;
@@ -4299,7 +4305,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4299
4305
} else if (status == READ_STATUS_FAILED) {
4300
4306
// Duplicate txindexes, the block is now in-flight, so just request it
4301
4307
std::vector<CInv> vInv (1 );
4302
- vInv[0 ] = CInv (MSG_BLOCK | GetFetchFlags (*peer), cmpctblock. header . GetHash () );
4308
+ vInv[0 ] = CInv (MSG_BLOCK | GetFetchFlags (*peer), blockhash );
4303
4309
m_connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::GETDATA, vInv));
4304
4310
return ;
4305
4311
}
@@ -4312,7 +4318,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4312
4318
if (req.indexes .empty ()) {
4313
4319
// Dirty hack to jump to BLOCKTXN code (TODO: move message handling into their own functions)
4314
4320
BlockTransactions txn;
4315
- txn.blockhash = cmpctblock. header . GetHash () ;
4321
+ txn.blockhash = blockhash ;
4316
4322
blockTxnMsg << txn;
4317
4323
fProcessBLOCKTXN = true ;
4318
4324
} else {
@@ -4342,7 +4348,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4342
4348
// We requested this block, but its far into the future, so our
4343
4349
// mempool will probably be useless - request the block normally
4344
4350
std::vector<CInv> vInv (1 );
4345
- vInv[0 ] = CInv (MSG_BLOCK | GetFetchFlags (*peer), cmpctblock. header . GetHash () );
4351
+ vInv[0 ] = CInv (MSG_BLOCK | GetFetchFlags (*peer), blockhash );
4346
4352
m_connman.PushMessage (&pfrom, msgMaker.Make (NetMsgType::GETDATA, vInv));
4347
4353
return ;
4348
4354
} else {
0 commit comments