Skip to content

Commit 37dcd12

Browse files
committed
scripted-diff: Rename recentRejects
-BEGIN VERIFY SCRIPT- ren() { sed -i "s:\<$1\>:$2:g" $(git grep -l "\<$1\>" ./src ./test); } ren recentRejects m_recent_rejects -END VERIFY SCRIPT-
1 parent cd9902a commit 37dcd12

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/net_processing.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ class PeerManagerImpl final : public PeerManager
470470
*
471471
* Memory used: 1.3 MB
472472
*/
473-
CRollingBloomFilter recentRejects GUARDED_BY(::cs_main){120'000, 0.000'001};
473+
CRollingBloomFilter m_recent_rejects GUARDED_BY(::cs_main){120'000, 0.000'001};
474474
uint256 hashRecentRejectsChainTip GUARDED_BY(cs_main);
475475

476476
/*
@@ -1604,7 +1604,7 @@ bool PeerManagerImpl::AlreadyHaveTx(const GenTxid& gtxid)
16041604
// or a double-spend. Reset the rejects filter and give those
16051605
// txs a second chance.
16061606
hashRecentRejectsChainTip = m_chainman.ActiveChain().Tip()->GetBlockHash();
1607-
recentRejects.reset();
1607+
m_recent_rejects.reset();
16081608
}
16091609

16101610
const uint256& hash = gtxid.GetHash();
@@ -1616,7 +1616,7 @@ bool PeerManagerImpl::AlreadyHaveTx(const GenTxid& gtxid)
16161616
if (m_recent_confirmed_transactions->contains(hash)) return true;
16171617
}
16181618

1619-
return recentRejects.contains(hash) || m_mempool.exists(gtxid);
1619+
return m_recent_rejects.contains(hash) || m_mempool.exists(gtxid);
16201620
}
16211621

16221622
bool PeerManagerImpl::AlreadyHaveBlock(const uint256& block_hash)
@@ -2235,7 +2235,7 @@ void PeerManagerImpl::ProcessOrphanTx(std::set<uint256>& orphan_work_set)
22352235
// See also comments in https://github.com/bitcoin/bitcoin/pull/18044#discussion_r443419034
22362236
// for concerns around weakening security of unupgraded nodes
22372237
// if we start doing this too early.
2238-
recentRejects.insert(porphanTx->GetWitnessHash());
2238+
m_recent_rejects.insert(porphanTx->GetWitnessHash());
22392239
// If the transaction failed for TX_INPUTS_NOT_STANDARD,
22402240
// then we know that the witness was irrelevant to the policy
22412241
// failure, since this check depends only on the txid
@@ -2247,7 +2247,7 @@ void PeerManagerImpl::ProcessOrphanTx(std::set<uint256>& orphan_work_set)
22472247
if (state.GetResult() == TxValidationResult::TX_INPUTS_NOT_STANDARD && porphanTx->GetWitnessHash() != porphanTx->GetHash()) {
22482248
// We only add the txid if it differs from the wtxid, to
22492249
// avoid wasting entries in the rolling bloom filter.
2250-
recentRejects.insert(porphanTx->GetHash());
2250+
m_recent_rejects.insert(porphanTx->GetHash());
22512251
}
22522252
}
22532253
m_orphanage.EraseTx(orphanHash);
@@ -3250,7 +3250,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
32503250
std::sort(unique_parents.begin(), unique_parents.end());
32513251
unique_parents.erase(std::unique(unique_parents.begin(), unique_parents.end()), unique_parents.end());
32523252
for (const uint256& parent_txid : unique_parents) {
3253-
if (recentRejects.contains(parent_txid)) {
3253+
if (m_recent_rejects.contains(parent_txid)) {
32543254
fRejectedParents = true;
32553255
break;
32563256
}
@@ -3291,8 +3291,8 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
32913291
// regardless of what witness is provided, we will not accept
32923292
// this, so we don't need to allow for redownload of this txid
32933293
// from any of our non-wtxidrelay peers.
3294-
recentRejects.insert(tx.GetHash());
3295-
recentRejects.insert(tx.GetWitnessHash());
3294+
m_recent_rejects.insert(tx.GetHash());
3295+
m_recent_rejects.insert(tx.GetWitnessHash());
32963296
m_txrequest.ForgetTxHash(tx.GetHash());
32973297
m_txrequest.ForgetTxHash(tx.GetWitnessHash());
32983298
}
@@ -3311,7 +3311,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
33113311
// See also comments in https://github.com/bitcoin/bitcoin/pull/18044#discussion_r443419034
33123312
// for concerns around weakening security of unupgraded nodes
33133313
// if we start doing this too early.
3314-
recentRejects.insert(tx.GetWitnessHash());
3314+
m_recent_rejects.insert(tx.GetWitnessHash());
33153315
m_txrequest.ForgetTxHash(tx.GetWitnessHash());
33163316
// If the transaction failed for TX_INPUTS_NOT_STANDARD,
33173317
// then we know that the witness was irrelevant to the policy
@@ -3322,7 +3322,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
33223322
// transactions are later received (resulting in
33233323
// parent-fetching by txid via the orphan-handling logic).
33243324
if (state.GetResult() == TxValidationResult::TX_INPUTS_NOT_STANDARD && tx.GetWitnessHash() != tx.GetHash()) {
3325-
recentRejects.insert(tx.GetHash());
3325+
m_recent_rejects.insert(tx.GetHash());
33263326
m_txrequest.ForgetTxHash(tx.GetHash());
33273327
}
33283328
if (RecursiveDynamicUsage(*ptx) < 100000) {
@@ -3331,21 +3331,21 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
33313331
}
33323332
}
33333333

3334-
// If a tx has been detected by recentRejects, we will have reached
3334+
// If a tx has been detected by m_recent_rejects, we will have reached
33353335
// this point and the tx will have been ignored. Because we haven't run
33363336
// the tx through AcceptToMemoryPool, we won't have computed a DoS
33373337
// score for it or determined exactly why we consider it invalid.
33383338
//
33393339
// This means we won't penalize any peer subsequently relaying a DoSy
33403340
// tx (even if we penalized the first peer who gave it to us) because
3341-
// we have to account for recentRejects showing false positives. In
3341+
// we have to account for m_recent_rejects showing false positives. In
33423342
// other words, we shouldn't penalize a peer if we aren't *sure* they
33433343
// submitted a DoSy tx.
33443344
//
3345-
// Note that recentRejects doesn't just record DoSy or invalid
3345+
// Note that m_recent_rejects doesn't just record DoSy or invalid
33463346
// transactions, but any tx not accepted by the mempool, which may be
33473347
// due to node policy (vs. consensus). So we can't blanket penalize a
3348-
// peer simply for relaying a tx that our recentRejects has caught,
3348+
// peer simply for relaying a tx that our m_recent_rejects has caught,
33493349
// regardless of false positives.
33503350

33513351
if (state.IsInvalid()) {

test/functional/mempool_reorg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def run_test(self):
8080
self.log.info("Generate a block")
8181
last_block = self.nodes[0].generate(1)
8282
# Sync blocks, so that peer 1 gets the block before timelock_tx
83-
# Otherwise, peer 1 would put the timelock_tx in recentRejects
83+
# Otherwise, peer 1 would put the timelock_tx in m_recent_rejects
8484
self.sync_all()
8585

8686
self.log.info("The time-locked transaction can now be spent")

test/functional/p2p_permissions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def check_tx_relay(self):
130130
tx.vout[0].nValue += 1
131131
txid = tx.rehash()
132132
# Send the transaction twice. The first time, it'll be rejected by ATMP because it conflicts
133-
# with a mempool transaction. The second time, it'll be in the recentRejects filter.
133+
# with a mempool transaction. The second time, it'll be in the m_recent_rejects filter.
134134
p2p_rebroadcast_wallet.send_txs_and_test(
135135
[tx],
136136
self.nodes[1],

0 commit comments

Comments
 (0)