Skip to content

Commit fa2662c

Browse files
author
MarcoFalke
committed
net: Avoid logging AlreadyHaveTx when disconnecting misbehaving peer
Can be reviewed with --color-moved=dimmed-zebra
1 parent 226731a commit fa2662c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/net_processing.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2949,16 +2949,17 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
29492949
best_block = &inv.hash;
29502950
}
29512951
} else if (inv.IsGenTxMsg()) {
2952+
if (reject_tx_invs) {
2953+
LogPrint(BCLog::NET, "transaction (%s) inv sent in violation of protocol, disconnecting peer=%d\n", inv.hash.ToString(), pfrom.GetId());
2954+
pfrom.fDisconnect = true;
2955+
return;
2956+
}
29522957
const GenTxid gtxid = ToGenTxid(inv);
29532958
const bool fAlreadyHave = AlreadyHaveTx(gtxid);
29542959
LogPrint(BCLog::NET, "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom.GetId());
29552960

29562961
pfrom.AddKnownTx(inv.hash);
2957-
if (reject_tx_invs) {
2958-
LogPrint(BCLog::NET, "transaction (%s) inv sent in violation of protocol, disconnecting peer=%d\n", inv.hash.ToString(), pfrom.GetId());
2959-
pfrom.fDisconnect = true;
2960-
return;
2961-
} else if (!fAlreadyHave && !m_chainman.ActiveChainstate().IsInitialBlockDownload()) {
2962+
if (!fAlreadyHave && !m_chainman.ActiveChainstate().IsInitialBlockDownload()) {
29622963
AddTxAnnouncement(pfrom, gtxid, current_time);
29632964
}
29642965
} else {

0 commit comments

Comments
 (0)