mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
[net_processing] Move SendBlockTransactions into PeerManager
This commit is contained in:
@@ -1828,7 +1828,7 @@ static uint32_t GetFetchFlags(const CNode& pfrom) EXCLUSIVE_LOCKS_REQUIRED(cs_ma
|
||||
return nFetchFlags;
|
||||
}
|
||||
|
||||
inline void static SendBlockTransactions(const CBlock& block, const BlockTransactionsRequest& req, CNode& pfrom, CConnman& connman) {
|
||||
void PeerManager::SendBlockTransactions(CNode& pfrom, const CBlock& block, const BlockTransactionsRequest& req) {
|
||||
BlockTransactions resp(req);
|
||||
for (size_t i = 0; i < req.indexes.size(); i++) {
|
||||
if (req.indexes[i] >= block.vtx.size()) {
|
||||
@@ -1840,7 +1840,7 @@ inline void static SendBlockTransactions(const CBlock& block, const BlockTransac
|
||||
LOCK(cs_main);
|
||||
const CNetMsgMaker msgMaker(pfrom.GetSendVersion());
|
||||
int nSendFlags = State(pfrom.GetId())->fWantsCmpctWitness ? 0 : SERIALIZE_TRANSACTION_NO_WITNESS;
|
||||
connman.PushMessage(&pfrom, msgMaker.Make(nSendFlags, NetMsgType::BLOCKTXN, resp));
|
||||
m_connman.PushMessage(&pfrom, msgMaker.Make(nSendFlags, NetMsgType::BLOCKTXN, resp));
|
||||
}
|
||||
|
||||
void PeerManager::ProcessHeadersMessage(CNode& pfrom, const std::vector<CBlockHeader>& headers, bool via_compact_block)
|
||||
@@ -2845,7 +2845,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
||||
// Unlock cs_most_recent_block to avoid cs_main lock inversion
|
||||
}
|
||||
if (recent_block) {
|
||||
SendBlockTransactions(*recent_block, req, pfrom, m_connman);
|
||||
SendBlockTransactions(pfrom, *recent_block, req);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2878,7 +2878,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
||||
bool ret = ReadBlockFromDisk(block, pindex, m_chainparams.GetConsensus());
|
||||
assert(ret);
|
||||
|
||||
SendBlockTransactions(block, req, pfrom, m_connman);
|
||||
SendBlockTransactions(pfrom, block, req);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user