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 <john@johnnewbery.com>
This commit is contained in:
1 file changed
+2
-9
@@ -2654,14 +2654,12 @@ void PeerLogicValidation::ProcessMessage(CNode& pfrom, const std::string& msg_ty
|
|||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|
||||||
uint32_t nFetchFlags = GetFetchFlags(pfrom);
|
|
||||||
const auto current_time = GetTime<std::chrono::microseconds>();
|
const auto current_time = GetTime<std::chrono::microseconds>();
|
||||||
uint256* best_block{nullptr};
|
uint256* best_block{nullptr};
|
||||||
|
|
||||||
for (CInv &inv : vInv)
|
for (CInv &inv : vInv)
|
||||||
{
|
{
|
||||||
if (interruptMsgProc)
|
if (interruptMsgProc) return;
|
||||||
return;
|
|
||||||
|
|
||||||
// Ignore INVs that don't match wtxidrelay setting.
|
// Ignore INVs that don't match wtxidrelay setting.
|
||||||
// Note that orphan parent fetching always uses MSG_TX GETDATAs regardless of the wtxidrelay setting.
|
// 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
|
|||||||
bool fAlreadyHave = AlreadyHave(inv, m_mempool);
|
bool fAlreadyHave = AlreadyHave(inv, m_mempool);
|
||||||
LogPrint(BCLog::NET, "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom.GetId());
|
LogPrint(BCLog::NET, "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom.GetId());
|
||||||
|
|
||||||
if (inv.IsMsgTx()) {
|
|
||||||
inv.type |= nFetchFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inv.type == MSG_BLOCK) {
|
if (inv.type == MSG_BLOCK) {
|
||||||
UpdateBlockAvailability(pfrom.GetId(), inv.hash);
|
UpdateBlockAvailability(pfrom.GetId(), inv.hash);
|
||||||
if (!fAlreadyHave && !fImporting && !fReindex && !mapBlocksInFlight.count(inv.hash)) {
|
if (!fAlreadyHave && !fImporting && !fReindex && !mapBlocksInFlight.count(inv.hash)) {
|
||||||
@@ -3013,7 +3007,6 @@ void PeerLogicValidation::ProcessMessage(CNode& pfrom, const std::string& msg_ty
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!fRejectedParents) {
|
if (!fRejectedParents) {
|
||||||
uint32_t nFetchFlags = GetFetchFlags(pfrom);
|
|
||||||
const auto current_time = GetTime<std::chrono::microseconds>();
|
const auto current_time = GetTime<std::chrono::microseconds>();
|
||||||
|
|
||||||
for (const uint256& parent_txid : unique_parents) {
|
for (const uint256& parent_txid : unique_parents) {
|
||||||
@@ -3022,7 +3015,7 @@ void PeerLogicValidation::ProcessMessage(CNode& pfrom, const std::string& msg_ty
|
|||||||
// wtxidrelay peers.
|
// wtxidrelay peers.
|
||||||
// Eventually we should replace this with an improved
|
// Eventually we should replace this with an improved
|
||||||
// protocol for getting all unconfirmed parents.
|
// protocol for getting all unconfirmed parents.
|
||||||
CInv _inv(MSG_TX | nFetchFlags, parent_txid);
|
CInv _inv(MSG_TX, parent_txid);
|
||||||
pfrom.AddKnownTx(parent_txid);
|
pfrom.AddKnownTx(parent_txid);
|
||||||
if (!AlreadyHave(_inv, m_mempool)) RequestTx(State(pfrom.GetId()), ToGenTxid(_inv), current_time);
|
if (!AlreadyHave(_inv, m_mempool)) RequestTx(State(pfrom.GetId()), ToGenTxid(_inv), current_time);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user