mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
log: net: new header over cmpctblock
This commit is contained in:
parent
40e1c4d402
commit
e5ce857634
1 changed files with 11 additions and 5 deletions
|
@ -4190,6 +4190,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||||
vRecv >> cmpctblock;
|
vRecv >> cmpctblock;
|
||||||
|
|
||||||
bool received_new_header = false;
|
bool received_new_header = false;
|
||||||
|
const auto blockhash = cmpctblock.header.GetHash();
|
||||||
|
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
@ -4207,7 +4208,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_chainman.m_blockman.LookupBlockIndex(cmpctblock.header.GetHash())) {
|
if (!m_chainman.m_blockman.LookupBlockIndex(blockhash)) {
|
||||||
received_new_header = true;
|
received_new_header = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4221,6 +4222,11 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (received_new_header) {
|
||||||
|
LogPrintfCategory(BCLog::NET, "Saw new cmpctblock header hash=%s peer=%d\n",
|
||||||
|
blockhash.ToString(), pfrom.GetId());
|
||||||
|
}
|
||||||
|
|
||||||
// When we succeed in decoding a block's txids from a cmpctblock
|
// When we succeed in decoding a block's txids from a cmpctblock
|
||||||
// message we typically jump to the BLOCKTXN handling code, with a
|
// message we typically jump to the BLOCKTXN handling code, with a
|
||||||
// dummy (empty) BLOCKTXN message, to re-use the logic there in
|
// 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,
|
||||||
// We requested this block for some reason, but our mempool will probably be useless
|
// We requested this block for some reason, but our mempool will probably be useless
|
||||||
// so we just grab the block via normal getdata
|
// so we just grab the block via normal getdata
|
||||||
std::vector<CInv> vInv(1);
|
std::vector<CInv> vInv(1);
|
||||||
vInv[0] = CInv(MSG_BLOCK | GetFetchFlags(*peer), cmpctblock.header.GetHash());
|
vInv[0] = CInv(MSG_BLOCK | GetFetchFlags(*peer), blockhash);
|
||||||
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::GETDATA, vInv));
|
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::GETDATA, vInv));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -4299,7 +4305,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||||
} else if (status == READ_STATUS_FAILED) {
|
} else if (status == READ_STATUS_FAILED) {
|
||||||
// Duplicate txindexes, the block is now in-flight, so just request it
|
// Duplicate txindexes, the block is now in-flight, so just request it
|
||||||
std::vector<CInv> vInv(1);
|
std::vector<CInv> vInv(1);
|
||||||
vInv[0] = CInv(MSG_BLOCK | GetFetchFlags(*peer), cmpctblock.header.GetHash());
|
vInv[0] = CInv(MSG_BLOCK | GetFetchFlags(*peer), blockhash);
|
||||||
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::GETDATA, vInv));
|
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::GETDATA, vInv));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4312,7 +4318,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||||
if (req.indexes.empty()) {
|
if (req.indexes.empty()) {
|
||||||
// Dirty hack to jump to BLOCKTXN code (TODO: move message handling into their own functions)
|
// Dirty hack to jump to BLOCKTXN code (TODO: move message handling into their own functions)
|
||||||
BlockTransactions txn;
|
BlockTransactions txn;
|
||||||
txn.blockhash = cmpctblock.header.GetHash();
|
txn.blockhash = blockhash;
|
||||||
blockTxnMsg << txn;
|
blockTxnMsg << txn;
|
||||||
fProcessBLOCKTXN = true;
|
fProcessBLOCKTXN = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -4342,7 +4348,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||||
// We requested this block, but its far into the future, so our
|
// We requested this block, but its far into the future, so our
|
||||||
// mempool will probably be useless - request the block normally
|
// mempool will probably be useless - request the block normally
|
||||||
std::vector<CInv> vInv(1);
|
std::vector<CInv> vInv(1);
|
||||||
vInv[0] = CInv(MSG_BLOCK | GetFetchFlags(*peer), cmpctblock.header.GetHash());
|
vInv[0] = CInv(MSG_BLOCK | GetFetchFlags(*peer), blockhash);
|
||||||
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::GETDATA, vInv));
|
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::GETDATA, vInv));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue