mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
Merge #19219: Replace automatic bans with discouragement filter
2ad58381ffClean up separated ban/discourage interface (Pieter Wuille)b691f2df5fReplace automatic bans with discouragement filter (Pieter Wuille) Pull request description: This patch improves performance and resource usage around IP addresses that are banned for misbehavior. They're already not actually banned since #14929, as connections from them are still allowed, but they are preferred for eviction if the inbound connection slots are full. Stop treating these like manually banned IP ranges, and instead just keep them in a rolling Bloom filter of misbehaving nodes, which isn't persisted to disk or exposed through the ban framework. The effect remains the same: preferred for eviction, avoided for outgoing connections, and not relayed to other peers. Also change the name of this mechanism to "discouraged" to better reflect reality. ACKs for top commit: naumenkogs: utACK2ad58381ffamitiuttarwar: code review ACK2ad58381ffjonatack: ACK2ad5838per changes since last review `git range-diff3276c141f7e0ca 2ad5838` jnewbery: Code review ACK2ad58381ffTree-SHA512: 5dedef401d9cbfa026812651303e6286223563dbeed7a10766ed536ac9e3f29ed4bd0df29cc6deadceeb35cbe9f066346add14ef0833958ca9f93d123fe7aab5
This commit is contained in:
@@ -18,18 +18,11 @@ void test_one_input(const std::vector<uint8_t>& buffer)
|
||||
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
|
||||
|
||||
const CBanEntry ban_entry = [&] {
|
||||
switch (fuzzed_data_provider.ConsumeIntegralInRange<int>(0, 3)) {
|
||||
switch (fuzzed_data_provider.ConsumeIntegralInRange<int>(0, 2)) {
|
||||
case 0:
|
||||
return CBanEntry{fuzzed_data_provider.ConsumeIntegral<int64_t>()};
|
||||
break;
|
||||
case 1:
|
||||
return CBanEntry{fuzzed_data_provider.ConsumeIntegral<int64_t>(), fuzzed_data_provider.PickValueInArray<BanReason>({
|
||||
BanReason::BanReasonUnknown,
|
||||
BanReason::BanReasonNodeMisbehaving,
|
||||
BanReason::BanReasonManuallyAdded,
|
||||
})};
|
||||
break;
|
||||
case 2: {
|
||||
case 1: {
|
||||
const std::optional<CBanEntry> ban_entry = ConsumeDeserializable<CBanEntry>(fuzzed_data_provider);
|
||||
if (ban_entry) {
|
||||
return *ban_entry;
|
||||
@@ -39,5 +32,4 @@ void test_one_input(const std::vector<uint8_t>& buffer)
|
||||
}
|
||||
return CBanEntry{};
|
||||
}();
|
||||
assert(!ban_entry.banReasonToString().empty());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user