-
Notifications
You must be signed in to change notification settings - Fork 38.6k
banman: save the banlist in a JSON format on disk #20966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(off topic reply deleted)
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
|
Concept ACK |
|
790727eea..fd751850e: add the tests from #20904 (closed without merge), they are precious |
|
fd751850e..2d287f639: add release notes |
doc/release-notes.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the release notes to https://github.com/bitcoin-core/bitcoin-devwiki/wiki/%2320852-Release-notes-snippet
Otherwise they will have to be removed here after merge, then added to the 0.21 branch. (Release notes are only added to the point releases, not the next major version that also includes those fixes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess after/if this PR is merged?
|
Concept ACK |
|
2d287f639...fd751850e: remove edits of |
|
Notes:
|
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK.
Should try to read JSON first, and if it exists then skip old format? Or am I missing something?
Personally I wouldn't add from/to JSON in CBanEntry, BanMapFromJson and BanMapToJson seem enough. Also, there should be some validation in BanMapFromJson?
|
fd751850e...e74196741: read
I made it to read both if present so that if the user temporary downgrades and makes some changes to
Right! Added |
|
needs rebase after #21167 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-ACK 4b52c7234f3c2e3067d7d6c6fd7ebf2b96bb8a45 per git range-diff 5c4f0c4 88b843e 4b52c72, rebase only, debug build clean, test passes, repeatedly tested banning/unbanning peers on signet while inspecting banlist.json in my editor including through restarts. However, there are gotchas when downgrading/upgrading; it may be a good idea to warn and suggest best practices about that in the release note.
Regarding the release note, peers may be banned and unbanned via the GUI peers window in addition to the setban RPC. As mentioned in my previous comment, it may be a good idea to describe user gotchas and best practices for upgrading and downgrading. |
|
utACK 4b52c7234f3c2e3067d7d6c6fd7ebf2b96bb8a45 I think it would be useful to make the code ignore future version numbers, so it will not completely wipe banlists on downgrading (from future versions that introduce additional features to this format), but that can be done later. |
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK 4b52c7234f3c2e3067d7d6c6fd7ebf2b96bb8a45.
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 bitcoin#20904 Resolves bitcoin#19748
With `banlist.dat` (being written in addrv1 format) if we would try to write a Tor v3 subnet, it would serialize as a dummy-all-0s IPv6 address and subsequently, when deserialized will not result in the same subnet. This problem does not exist with `banlist.json` where the data is saved in textual, human-readable form.
|
|
|
|
|
Code review re-ACK bb719a0 per |
|
Code Review ACK bb719a0 |
|
Removed from backport, but if someone wants to backport, it will need to be done together with #20852 (comment) |
…anlist.json faa6c3d net: Drop only invalid entries when reading banlist.json (MarcoFalke) Pull request description: All entries will be dropped when there is at least one invalid one in `banlist.json`. Fix this by only dropping invalid ones. Also suggested in bitcoin/bitcoin#20966 (comment) ACKs for top commit: laanwj: Re-ACK faa6c3d Tree-SHA512: 5a58e7f1dcabf78d0c65d8c6d5d997063af1efeaa50ca7730fc00056fda7e0061b6f7a38907ea045fe667c9f61d392e01e556b425a95e6b126e3c41cd33deb83
faa6c3d net: Drop only invalid entries when reading banlist.json (MarcoFalke) Pull request description: All entries will be dropped when there is at least one invalid one in `banlist.json`. Fix this by only dropping invalid ones. Also suggested in bitcoin#20966 (comment) ACKs for top commit: laanwj: Re-ACK faa6c3d Tree-SHA512: 5a58e7f1dcabf78d0c65d8c6d5d997063af1efeaa50ca7730fc00056fda7e0061b6f7a38907ea045fe667c9f61d392e01e556b425a95e6b126e3c41cd33deb83
Save the banlist in
banlist.jsoninstead ofbanlist.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.datif it exists andbanlist.jsondoes not exist (first start after an upgrade).Supersedes #20904
Resolves #19748