@@ -1445,9 +1445,9 @@ bool static AlreadyHave(const CInv& inv, const CTxMemPool& mempool) EXCLUSIVE_LO
1445
1445
1446
1446
{
1447
1447
LOCK (g_cs_orphans);
1448
- if (inv.type != MSG_WTX && mapOrphanTransactions.count (inv.hash )) {
1448
+ if (! inv.IsMsgWtx () && mapOrphanTransactions.count (inv.hash )) {
1449
1449
return true ;
1450
- } else if (inv.type == MSG_WTX && g_orphans_by_wtxid.count (inv.hash )) {
1450
+ } else if (inv.IsMsgWtx () && g_orphans_by_wtxid.count (inv.hash )) {
1451
1451
return true ;
1452
1452
}
1453
1453
}
@@ -1457,8 +1457,7 @@ bool static AlreadyHave(const CInv& inv, const CTxMemPool& mempool) EXCLUSIVE_LO
1457
1457
if (g_recent_confirmed_transactions->contains (inv.hash )) return true ;
1458
1458
}
1459
1459
1460
- const bool by_wtxid = (inv.type == MSG_WTX);
1461
- return recentRejects->contains (inv.hash ) || mempool.exists (inv.hash , by_wtxid);
1460
+ return recentRejects->contains (inv.hash ) || mempool.exists (inv.hash , inv.IsMsgWtx ());
1462
1461
}
1463
1462
case MSG_BLOCK:
1464
1463
case MSG_WITNESS_BLOCK:
@@ -1719,7 +1718,7 @@ void static ProcessGetData(CNode& pfrom, const CChainParams& chainparams, CConnm
1719
1718
// Process as many TX items from the front of the getdata queue as
1720
1719
// possible, since they're common and it's efficient to batch process
1721
1720
// them.
1722
- while (it != pfrom.vRecvGetData .end () && ( it->type == MSG_TX || it-> type == MSG_WITNESS_TX || it-> type == MSG_WTX )) {
1721
+ while (it != pfrom.vRecvGetData .end () && it->IsGenTxMsg ( )) {
1723
1722
if (interruptMsgProc) return ;
1724
1723
// The send buffer provides backpressure. If there's no space in
1725
1724
// the buffer, pause processing until the next call.
@@ -1732,10 +1731,10 @@ void static ProcessGetData(CNode& pfrom, const CChainParams& chainparams, CConnm
1732
1731
continue ;
1733
1732
}
1734
1733
1735
- CTransactionRef tx = FindTxForGetData (pfrom, inv.hash , inv.type == MSG_WTX , mempool_req, now);
1734
+ CTransactionRef tx = FindTxForGetData (pfrom, inv.hash , inv.IsMsgWtx () , mempool_req, now);
1736
1735
if (tx) {
1737
1736
// WTX and WITNESS_TX imply we serialize with witness
1738
- int nSendFlags = (inv.type == MSG_TX ? SERIALIZE_TRANSACTION_NO_WITNESS : 0 );
1737
+ int nSendFlags = (inv.IsMsgTx () ? SERIALIZE_TRANSACTION_NO_WITNESS : 0 );
1739
1738
connman.PushMessage (&pfrom, msgMaker.Make (nSendFlags, NetMsgType::TX, *tx));
1740
1739
mempool.RemoveUnbroadcastTx (tx->GetHash ());
1741
1740
// As we're going to send tx, make sure its unconfirmed parents are made requestable.
@@ -2654,15 +2653,15 @@ void ProcessMessage(
2654
2653
2655
2654
// ignore INVs that don't match wtxidrelay setting
2656
2655
if (State (pfrom.GetId ())->m_wtxid_relay ) {
2657
- if (inv.type == MSG_TX ) continue ;
2656
+ if (inv.IsMsgTx () ) continue ;
2658
2657
} else {
2659
- if (inv.type == MSG_WTX ) continue ;
2658
+ if (inv.IsMsgWtx () ) continue ;
2660
2659
}
2661
2660
2662
2661
bool fAlreadyHave = AlreadyHave (inv, mempool);
2663
2662
LogPrint (BCLog::NET, " got inv: %s %s peer=%d\n " , inv.ToString (), fAlreadyHave ? " have" : " new" , pfrom.GetId ());
2664
2663
2665
- if (inv.type == MSG_TX ) {
2664
+ if (inv.IsMsgTx () ) {
2666
2665
inv.type |= nFetchFlags;
2667
2666
}
2668
2667
@@ -3694,7 +3693,7 @@ void ProcessMessage(
3694
3693
vRecv >> vInv;
3695
3694
if (vInv.size () <= MAX_PEER_TX_IN_FLIGHT + MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
3696
3695
for (CInv &inv : vInv) {
3697
- if (inv.type == MSG_TX || inv. type == MSG_WITNESS_TX || inv. type == MSG_WTX ) {
3696
+ if (inv.IsGenTxMsg () ) {
3698
3697
// If we receive a NOTFOUND message for a txid we requested, erase
3699
3698
// it from our data structures for this peer.
3700
3699
auto in_flight_it = state->m_tx_download .m_tx_in_flight .find (inv.hash );
0 commit comments