@@ -2647,7 +2647,9 @@ void ProcessMessage(
26472647 if (interruptMsgProc)
26482648 return ;
26492649
2650- // ignore INVs that don't match wtxidrelay setting
2650+ // Ignore INVs that don't match wtxidrelay setting.
2651+ // Note that orphan parent fetching always uses MSG_TX GETDATAs regardless of the wtxidrelay setting.
2652+ // This is fine as no INV messages are involved in that process.
26512653 if (State (pfrom.GetId ())->m_wtxid_relay ) {
26522654 if (inv.IsMsgTx ()) continue ;
26532655 } else {
@@ -2931,9 +2933,11 @@ void ProcessMessage(
29312933
29322934 TxValidationState state;
29332935
2934- nodestate->m_tx_download .m_tx_announced .erase (hash);
2935- nodestate->m_tx_download .m_tx_in_flight .erase (hash);
2936- EraseTxRequest (hash);
2936+ for (uint256 hash : {txid, wtxid}) {
2937+ nodestate->m_tx_download .m_tx_announced .erase (hash);
2938+ nodestate->m_tx_download .m_tx_in_flight .erase (hash);
2939+ EraseTxRequest (hash);
2940+ }
29372941
29382942 std::list<CTransactionRef> lRemovedTxn;
29392943
@@ -2985,17 +2989,15 @@ void ProcessMessage(
29852989 uint32_t nFetchFlags = GetFetchFlags (pfrom);
29862990 const auto current_time = GetTime<std::chrono::microseconds>();
29872991
2988- if (!State (pfrom.GetId ())->m_wtxid_relay ) {
2989- for (const CTxIn& txin : tx.vin ) {
2990- // Here, we only have the txid (and not wtxid) of the
2991- // inputs, so we only request parents from
2992- // non-wtxid-relay peers.
2993- // Eventually we should replace this with an improved
2994- // protocol for getting all unconfirmed parents.
2995- CInv _inv (MSG_TX | nFetchFlags, txin.prevout .hash );
2996- pfrom.AddKnownTx (txin.prevout .hash );
2997- if (!AlreadyHave (_inv, mempool)) RequestTx (State (pfrom.GetId ()), ToGenTxid (_inv), current_time);
2998- }
2992+ for (const CTxIn& txin : tx.vin ) {
2993+ // Here, we only have the txid (and not wtxid) of the
2994+ // inputs, so we only request in txid mode, even for
2995+ // wtxidrelay peers.
2996+ // Eventually we should replace this with an improved
2997+ // protocol for getting all unconfirmed parents.
2998+ CInv _inv (MSG_TX | nFetchFlags, txin.prevout .hash );
2999+ pfrom.AddKnownTx (txin.prevout .hash );
3000+ if (!AlreadyHave (_inv, mempool)) RequestTx (State (pfrom.GetId ()), ToGenTxid (_inv), current_time);
29993001 }
30003002 AddOrphanTx (ptx, pfrom.GetId ());
30013003
0 commit comments