aboutsummaryrefslogtreecommitdiff
path: root/src/banman.cpp
AgeCommit message (Collapse)Author
2022-01-28Fix race condition for SetBannedSetDirty() callsHennadii Stepanov
Another thread can `SetBannedSetDirty(true)` while `CBanDB::Write()` call being executed. The following `SetBannedSetDirty(false)` effectively makes `m_is_dirty` flag value inconsistent with the actual `m_banned` state. Such behavior can result in data loss, e.g., during shutdown.
2022-01-28Avoid calling BanMan::SweepBanned() twice in a rowHennadii Stepanov
2022-01-28Fix data race condition in BanMan::DumpBanlist()Hennadii Stepanov
The m_is_dirty value being read in BannedSetIsDirty() can differ from the value being set in SweepBanned(), i.e., be inconsistent with a BanMan instance internal state.
2022-01-28Prevent possible concurrent CBanDB::Write() callsHennadii Stepanov
2021-12-30scripted-diff: Bump copyright headersHennadii Stepanov
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT- Commits of previous years: * 2020: fa0074e2d82928016a43ca408717154a1c70a4db * 2019: aaaaad6ac95b402fe18d019d67897ced6b316ee0
2021-07-30Ignore banlist.datMarcoFalke
This also allows to remove the "dirty" argument, which can now be deduced from the return value of Read().
2021-06-21banman: save the banlist in a JSON format on diskVasil Dimov
Save the banlist in `banlist.json` instead of `banlist.dat`. This makes it possible to store Tor v3 entries in the banlist on disk (and any other addresses that cannot be serialized in addrv1 format). Only read `banlist.dat` if it exists and `banlist.json` does not exist (first start after an upgrade). Supersedes https://github.com/bitcoin/bitcoin/pull/20904 Resolves https://github.com/bitcoin/bitcoin/issues/19748
2021-05-02scripted-diff: Replace three dots with ellipsis in the UI stringsHennadii Stepanov
-BEGIN VERIFY SCRIPT- sed -i -E -e 's/\.\.\."\)(\.|,|\)| )/…"\)\1/' -- $(git ls-files -- 'src' ':(exclude)src/qt/bitcoinstrings.cpp') sed -i -e 's/\.\.\.\\"/…\\"/' src/qt/sendcoinsdialog.cpp sed -i -e 's|\.\.\.</string>|…</string>|' src/qt/forms/*.ui sed -i -e 's|\.\.\.)</string>|…)</string>|' src/qt/forms/sendcoinsdialog.ui -END VERIFY SCRIPT-
2021-02-18log: Clarify log message when file does not existMarcoFalke
Also, run clang-format on the function
2020-12-31scripted-diff: Bump copyright headersMarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2020-10-12Ignore incorrectly-serialized banlist.dat entriesPieter Wuille
2020-07-08banlist: log post-swept banlist size at startupfanquake
We are currently logging the size of the banlist before SweepBanned() has been called, meaning the value may be incorrect.
2020-07-03Clean up separated ban/discourage interfacePieter Wuille
2020-07-03Replace automatic bans with discouragement filterPieter Wuille
This patch improves performance and resource usage around IP addresses that are banned for misbehavior. They're already not actually banned, 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 better reflect reality; they're not banned, just discouraged. Contains release notes and several interface improvements by John Newbery.
2020-06-27scripted-diff: Move ui_interface to the node libMarcoFalke
-BEGIN VERIFY SCRIPT- # Move files git mv src/ui_interface.h src/node/ui_interface.h git mv src/ui_interface.cpp src/node/ui_interface.cpp sed -i -e 's/BITCOIN_UI_INTERFACE_H/BITCOIN_NODE_UI_INTERFACE_H/g' src/node/ui_interface.h # Adjust includes and makefile sed -i -e 's|ui_interface|node/ui_interface|g' $(git grep -l ui_interface) # Sort includes git diff -U0 | clang-format-diff -p1 -i -v -END VERIFY SCRIPT-
2019-12-30scripted-diff: Bump copyright of files changed in 2019MarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2019-07-24scripted-diff: Make translation bilingualHennadii Stepanov
-BEGIN VERIFY SCRIPT- sed -i 's/inline std::string _(const char\* psz)/inline bilingual_str _(const char\* psz)/' src/util/translation.h sed -i 's/return G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz;/return bilingual_str{psz, G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz};/' src/util/translation.h sed -i 's/\b_("\([^"]\|\\"\)*")/&.translated/g' $(git grep --files-with-matches '\b_("' src) echo Hard cases - multiline strings. sed -i 's/"Visit %s for further information about the software.")/&.translated/g' src/init.cpp sed -i "s/\"Only rebuild the block database if you are sure that your computer's date and time are correct\")/&.translated/g" src/init.cpp sed -i 's/" restore from a backup.")/&.translated/g' src/wallet/db.cpp sed -i 's/" or address book entries might be missing or incorrect.")/&.translated/g' src/wallet/wallet.cpp echo Special case. sed -i 's/_(COPYRIGHT_HOLDERS)/&.translated/' src/util/system.cpp test/lint/lint-format-strings.py -END VERIFY SCRIPT-
2019-07-24Refactor out translation.hHennadii Stepanov
This is a prerequisite for introducing bilingual error messages. Note: #includes are arranged by clang-format-diff.py script.
2019-01-22Allow connections from misbehavior banned peers.Gregory Maxwell
This allows incoming connections from peers which are only banned due to an automatic misbehavior ban if doing so won't fill inbound. These peers are preferred for eviction when inbound fills, but may still be kept if they fall into the protected classes. This eviction preference lasts the entire life of the connection even if the ban expires. If they misbehave again they'll still get disconnected. The main purpose of banning on misbehavior is to prevent our connections from being wasted on unhelpful peers such as ones running incompatible consensus rules. For inbound peers this can be better accomplished with eviction preferences. A secondary purpose was to reduce resource waste from repeated abuse but virtually any attacker can get a nearly unlimited supply of addresses, so disconnection is about the best we can do.
2019-01-16scripted-diff: batch-recase BanMan variablesCarl Dong
-BEGIN VERIFY SCRIPT- sed -i "s/banMap/banmap/g" src/banman.h src/banman.cpp sed -i "s/netAddr/net_addr/g" src/banman.h src/banman.cpp sed -i "s/sinceUnixEpoch/since_unix_epoch/g" src/banman.h src/banman.cpp sed -i "s/bantimeoffset/ban_time_offset/g" src/banman.h src/banman.cpp sed -i "s/subNet/sub_net/g" src/banman.h src/banman.cpp sed -i "s/banReason/ban_reason/g" src/banman.h src/banman.cpp sed -i "s/notifyUI/notify_ui/g" src/banman.h src/banman.cpp sed -i "s/banEntry/ban_entry/g" src/banman.h src/banman.cpp sed -i "s/nStart/n_start/g" src/banman.h src/banman.cpp -END VERIFY SCRIPT-
2019-01-16banman: Add, use CBanEntry ctor that takes ban reasonCarl Dong
2019-01-16banman: reformulate nBanUtil calculationCarl Dong
Avoid reassigning parameters.
2019-01-16scripted-diff: batch-rename BanMan membersCory Fields
-BEGIN VERIFY SCRIPT- sed -i "s/clientInterface/m_client_interface/g" src/banman.h src/banman.cpp sed -i "s/setBannedIsDirty/m_is_dirty/g" src/banman.h src/banman.cpp sed -i "s/cs_setBanned/m_cs_banned/g" src/banman.h src/banman.cpp sed -i "s/setBanned/m_banned/g" src/banman.h src/banman.cpp -END VERIFY SCRIPT-
2019-01-16net: move BanMan to its own filesCory Fields