jnewbery
commented at 4:59 PM on April 19, 2017:
member
The listbanned RPC and QT show entries in the connman.setBanned set, even if the entry has expired. Expired entries in the set are only swept in the following circumstances:
bitcoind is stopped/started
the setban or clearbanned RPC is called
That means that the list of banned subnets returned by listbanned is inconsistent. If the node has been stop-started or the setban/clearbanned RPC has been called, then stale entries won't be shown. If the node hasn't been stop-started and those RPCs haven't been called, then stale entries will be shown.
This PR calls SweepBanned() before GetBanned() in the listbanned RPC and QT, so all calls to GetBanned() return an up-to-date list of banned subnets.
theuni
commented at 5:07 PM on April 19, 2017:
member
Nice find. Though I can't think of a good reason why we'd ever want a stale list coming out of GetBanned(). Why not just sweep there?
jonasschnelli
commented at 5:12 PM on April 19, 2017:
contributor
utACKea2c925c99969d06320495afbf1188f54e25e015
Calling sweep from within GetBanned() looks simpler in the first place but would break the assumption that GetBanned() can never change the setBannedIsDirty to true.
No strong opinion though.
jnewbery
commented at 5:25 PM on April 19, 2017:
member
Calling sweep from within GetBanned() looks simpler in the first place but would break the assumption that GetBanned() can never change the setBannedIsDirty to true.
Right. CConnman::DumpBanlist() sets SetBannedSetDirty and then calls GetBanned() (I believe making the assumption that GetBanned() wouldn't change SetBannedSetDirty). I didn't know whether it was safe to change that.
If you think that's ok, then calling sweep from with GetBanned() is obviously tidier, and means I don't need to make SweepBanned() public.
fanquake added the label P2P on Apr 19, 2017
luke-jr referenced this in commit 266df5ffab on Apr 21, 2017
luke-jr referenced this in commit f52e9257af on Apr 21, 2017
MarcoFalke
commented at 3:22 PM on April 23, 2017:
member
Needs rebase
laanwj
commented at 1:49 PM on April 25, 2017:
member
Note that this code is pretty racy either way. We should fix that as a follow-up.
[net] listbanned RPC and QT should show correct banned subnets77c54b270d
[tests] update disconnect_ban.py test case to work with listbannedd6732d832a
jnewbery force-pushed on Apr 28, 2017
jnewbery
commented at 3:25 PM on April 28, 2017:
member
thanks @theuni - that's definitely cleaner. I've changed this PR to use your fix.
laanwj
commented at 10:28 AM on May 1, 2017:
member
It fails locally here (every time, not just intermittently):
disconnect_ban.py failed, Duration: 26 s
stdout:
2017-05-01 08:21:38.048000 TestFramework (INFO): Initializing test directory /tmp/testh_zvdgd7/435
2017-05-01 08:21:39.087000 TestFramework (INFO): Test setban and listbanned RPCs
2017-05-01 08:21:39.087000 TestFramework (INFO): setban: successfully ban single IP address
2017-05-01 08:21:39.148000 TestFramework (INFO): clearbanned: successfully clear ban list
2017-05-01 08:21:39.179000 TestFramework (INFO): setban: fail to ban an already banned subnet
2017-05-01 08:21:39.184000 TestFramework (INFO): setban: fail to ban an invalid subnet
2017-05-01 08:21:39.189000 TestFramework (INFO): setban remove: fail to unban a non-banned subnet
2017-05-01 08:21:39.194000 TestFramework (INFO): setban remove: successfully unban subnet
2017-05-01 08:21:39.243000 TestFramework (INFO): setban: test persistence across node restart
2017-05-01 08:21:49.801000 TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
File "/store/orion/projects/bitcoin/bitcoin/test/functional/test_framework/test_framework.py", line 151, in main
self.run_test()
File "/home/orion/projects/bitcoin/bitcoin/test/functional/disconnect_ban.py", line 67, in run_test
assert wait_until(lambda: len(self.nodes[1].listbanned()) == 3, timeout=10)
AssertionError
2017-05-01 08:21:49.819000 TestFramework (INFO): Stopping nodes
2017-05-01 08:22:04.002000 TestFramework (WARNING): Not cleaning up dir /tmp/testh_zvdgd7/435
2017-05-01 08:22:04.003000 TestFramework (ERROR): Test failed. Test logging available at /tmp/testh_zvdgd7/435/test_
framework.log
jnewbery
commented at 5:48 PM on May 1, 2017:
member
@laanwj that's very strange. The test passes for me consistently, and also passes on travis. Can you try rebuilding and clearing the functional test cache. If it's still failing, can you send me the test logs?
laanwj
commented at 4:35 PM on May 2, 2017:
member
Seems to work now. Strange.
laanwj merged this on May 2, 2017
laanwj closed this on May 2, 2017
laanwj referenced this in commit faf2dea5ea on May 2, 2017
jnewbery deleted the branch on May 2, 2017
luke-jr referenced this in commit 2d4c2cf1e8 on Jun 3, 2017
luke-jr referenced this in commit 322e904b88 on Jun 3, 2017
luke-jr referenced this in commit 2f2e8d7af0 on Jun 5, 2017
luke-jr referenced this in commit fff3d6fbaf on Jun 5, 2017
luke-jr referenced this in commit 7033da5fbe on Jun 5, 2017
luke-jr referenced this in commit 963176b3d9 on Jun 5, 2017
luke-jr referenced this in commit 28734848dd on Jun 5, 2017
luke-jr referenced this in commit d289b564e3 on Jun 5, 2017
luke-jr referenced this in commit ee1a60d156 on Jun 5, 2017
luke-jr referenced this in commit e05799a381 on Jun 5, 2017
nomnombtc referenced this in commit d5bd983289 on Jul 17, 2017
nomnombtc referenced this in commit c8b124d782 on Jul 17, 2017
PastaPastaPasta referenced this in commit 3987f162ea on Jun 10, 2019
PastaPastaPasta referenced this in commit ed949c289a on Jun 10, 2019
PastaPastaPasta referenced this in commit e95b4f794f on Jun 10, 2019
PastaPastaPasta referenced this in commit a9b50b7a01 on Jun 10, 2019
PastaPastaPasta referenced this in commit bdd55a3aff on Jun 10, 2019
PastaPastaPasta referenced this in commit 7e79fa9087 on Jun 11, 2019
PastaPastaPasta referenced this in commit 3bf8c0f845 on Jun 11, 2019
PastaPastaPasta referenced this in commit eb65b08e80 on Jun 12, 2019
PastaPastaPasta referenced this in commit 7a9030db00 on Jun 14, 2019
PastaPastaPasta referenced this in commit 0ffa1e41ac on Jun 14, 2019
PastaPastaPasta referenced this in commit c1b7b65616 on Jun 14, 2019
PastaPastaPasta referenced this in commit 146cae9569 on Jun 14, 2019
PastaPastaPasta referenced this in commit e526914103 on Jun 15, 2019
PastaPastaPasta referenced this in commit 4712fe491f on Jun 19, 2019
barrystyle referenced this in commit 7f27855c86 on Jan 22, 2020
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2026-04-30 12:15 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me