Skip to content

Commit 39f1dc9

Browse files
committed
p2p: remove nFetchFlags from NetMsgType TX and INV processing
The nFetchFlags code can be removed here because GetFetchFlags() can only add the MSG_WITNESS_FLAG, which is added to the CInv::type field. That CInv is only passed to AlreadyHave() or ToGenTxid(), and neither of those functions do anything different depending on whether the CInv type is MSG_TX or MSG_WITNESS_TX. Co-authored by: John Newbery <[email protected]>
1 parent 471714e commit 39f1dc9

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/net_processing.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,14 +2654,12 @@ void PeerLogicValidation::ProcessMessage(CNode& pfrom, const std::string& msg_ty
26542654

26552655
LOCK(cs_main);
26562656

2657-
uint32_t nFetchFlags = GetFetchFlags(pfrom);
26582657
const auto current_time = GetTime<std::chrono::microseconds>();
26592658
uint256* best_block{nullptr};
26602659

26612660
for (CInv &inv : vInv)
26622661
{
2663-
if (interruptMsgProc)
2664-
return;
2662+
if (interruptMsgProc) return;
26652663

26662664
// Ignore INVs that don't match wtxidrelay setting.
26672665
// Note that orphan parent fetching always uses MSG_TX GETDATAs regardless of the wtxidrelay setting.
@@ -2675,10 +2673,6 @@ void PeerLogicValidation::ProcessMessage(CNode& pfrom, const std::string& msg_ty
26752673
bool fAlreadyHave = AlreadyHave(inv, m_mempool);
26762674
LogPrint(BCLog::NET, "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom.GetId());
26772675

2678-
if (inv.IsMsgTx()) {
2679-
inv.type |= nFetchFlags;
2680-
}
2681-
26822676
if (inv.type == MSG_BLOCK) {
26832677
UpdateBlockAvailability(pfrom.GetId(), inv.hash);
26842678
if (!fAlreadyHave && !fImporting && !fReindex && !mapBlocksInFlight.count(inv.hash)) {
@@ -3013,7 +3007,6 @@ void PeerLogicValidation::ProcessMessage(CNode& pfrom, const std::string& msg_ty
30133007
}
30143008
}
30153009
if (!fRejectedParents) {
3016-
uint32_t nFetchFlags = GetFetchFlags(pfrom);
30173010
const auto current_time = GetTime<std::chrono::microseconds>();
30183011

30193012
for (const uint256& parent_txid : unique_parents) {
@@ -3022,7 +3015,7 @@ void PeerLogicValidation::ProcessMessage(CNode& pfrom, const std::string& msg_ty
30223015
// wtxidrelay peers.
30233016
// Eventually we should replace this with an improved
30243017
// protocol for getting all unconfirmed parents.
3025-
CInv _inv(MSG_TX | nFetchFlags, parent_txid);
3018+
CInv _inv(MSG_TX, parent_txid);
30263019
pfrom.AddKnownTx(parent_txid);
30273020
if (!AlreadyHave(_inv, m_mempool)) RequestTx(State(pfrom.GetId()), ToGenTxid(_inv), current_time);
30283021
}

0 commit comments

Comments
 (0)