@@ -6295,32 +6295,33 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
6295
6295
//
6296
6296
// Message: getdata (transactions)
6297
6297
//
6298
- LOCK (m_tx_download_mutex);
6299
- std::vector<std::pair<NodeId, GenTxid>> expired;
6300
- auto requestable = m_txrequest.GetRequestable (pto->GetId (), current_time, &expired);
6301
- for (const auto & entry : expired) {
6302
- LogPrint (BCLog::NET, " timeout of inflight %s %s from peer=%d\n " , entry.second .IsWtxid () ? " wtx" : " tx" ,
6303
- entry.second .GetHash ().ToString (), entry.first );
6304
- }
6305
- for (const GenTxid& gtxid : requestable) {
6306
- // Exclude m_recent_rejects_reconsiderable: we may be requesting a missing parent
6307
- // that was previously rejected for being too low feerate.
6308
- if (!AlreadyHaveTx (gtxid, /* include_reconsiderable=*/ false )) {
6309
- LogPrint (BCLog::NET, " Requesting %s %s peer=%d\n " , gtxid.IsWtxid () ? " wtx" : " tx" ,
6310
- gtxid.GetHash ().ToString (), pto->GetId ());
6311
- vGetData.emplace_back (gtxid.IsWtxid () ? MSG_WTX : (MSG_TX | GetFetchFlags (*peer)), gtxid.GetHash ());
6312
- if (vGetData.size () >= MAX_GETDATA_SZ) {
6313
- MakeAndPushMessage (*pto, NetMsgType::GETDATA, vGetData);
6314
- vGetData.clear ();
6298
+ {
6299
+ LOCK (m_tx_download_mutex);
6300
+ std::vector<std::pair<NodeId, GenTxid>> expired;
6301
+ auto requestable = m_txrequest.GetRequestable (pto->GetId (), current_time, &expired);
6302
+ for (const auto & entry : expired) {
6303
+ LogPrint (BCLog::NET, " timeout of inflight %s %s from peer=%d\n " , entry.second .IsWtxid () ? " wtx" : " tx" ,
6304
+ entry.second .GetHash ().ToString (), entry.first );
6305
+ }
6306
+ for (const GenTxid& gtxid : requestable) {
6307
+ // Exclude m_recent_rejects_reconsiderable: we may be requesting a missing parent
6308
+ // that was previously rejected for being too low feerate.
6309
+ if (!AlreadyHaveTx (gtxid, /* include_reconsiderable=*/ false )) {
6310
+ LogPrint (BCLog::NET, " Requesting %s %s peer=%d\n " , gtxid.IsWtxid () ? " wtx" : " tx" ,
6311
+ gtxid.GetHash ().ToString (), pto->GetId ());
6312
+ vGetData.emplace_back (gtxid.IsWtxid () ? MSG_WTX : (MSG_TX | GetFetchFlags (*peer)), gtxid.GetHash ());
6313
+ if (vGetData.size () >= MAX_GETDATA_SZ) {
6314
+ MakeAndPushMessage (*pto, NetMsgType::GETDATA, vGetData);
6315
+ vGetData.clear ();
6316
+ }
6317
+ m_txrequest.RequestedTx (pto->GetId (), gtxid.GetHash (), current_time + GETDATA_TX_INTERVAL);
6318
+ } else {
6319
+ // We have already seen this transaction, no need to download. This is just a belt-and-suspenders, as
6320
+ // this should already be called whenever a transaction becomes AlreadyHaveTx().
6321
+ m_txrequest.ForgetTxHash (gtxid.GetHash ());
6315
6322
}
6316
- m_txrequest.RequestedTx (pto->GetId (), gtxid.GetHash (), current_time + GETDATA_TX_INTERVAL);
6317
- } else {
6318
- // We have already seen this transaction, no need to download. This is just a belt-and-suspenders, as
6319
- // this should already be called whenever a transaction becomes AlreadyHaveTx().
6320
- m_txrequest.ForgetTxHash (gtxid.GetHash ());
6321
6323
}
6322
- }
6323
-
6324
+ } // release m_tx_download_mutex
6324
6325
6325
6326
if (!vGetData.empty ())
6326
6327
MakeAndPushMessage (*pto, NetMsgType::GETDATA, vGetData);
0 commit comments