-
Notifications
You must be signed in to change notification settings - Fork 38.7k
[net] listbanned RPC and QT should show correct banned subnets #10234
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
|
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? |
|
utACK ea2c925c99969d06320495afbf1188f54e25e015 |
Right. If you think that's ok, then calling sweep from with |
Github-Pull: bitcoin#10234 Rebased-From: d711a3895c3498a8f29091921c93b303b370074b
Github-Pull: bitcoin#10234 Rebased-From: ea2c925c99969d06320495afbf1188f54e25e015
|
Needs rebase |
|
Discussion on IRC: the |
ea2c925 to
1d14e5d
Compare
|
rebased with fix to disconnect_ban.py test suite. |
|
@jnewbery Yea, I'd prefer to see this moved to GetBanned(). Otherwise correct usage just isn't obvious enough (as evidenced by this bug). Ideally the sweep would be a static function operating on a banlist_t rather than this, but I don't think it's worth worrying about. Looks like the only other change needed would be: @@ -496,10 +499,9 @@ void CConnman::DumpBanlist()
CBanDB bandb;
banmap_t banmap;
- SetBannedSetDirty(false);
GetBanned(banmap);
- if (!bandb.Write(banmap))
- SetBannedSetDirty(true);
+ if (bandb.Write(banmap))
+ SetBannedSetDirty(false);Note that this code is pretty racy either way. We should fix that as a follow-up. |
1d14e5d to
d6732d8
Compare
|
thanks @theuni - that's definitely cleaner. I've changed this PR to use your fix. |
|
It fails locally here (every time, not just intermittently): |
|
@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? |
|
Seems to work now. Strange. |
…subnets d6732d8 [tests] update disconnect_ban.py test case to work with listbanned (John Newbery) 77c54b2 [net] listbanned RPC and QT should show correct banned subnets (John Newbery) Tree-SHA512: edd0e43377d456260d2697213c2829f8483630f3a668b6707d52605faefa610d951d10e6f22a95eff483cbd14faa8ac9b69fa7d3c0b5735c5f3df23fd71282e0
Github-Pull: bitcoin#10234 Rebased-From: 77c54b2
Github-Pull: bitcoin#10234 Rebased-From: d6732d8
… branch 'disconnect_ban_fixes-0.14' into 0.14.2_fixes
…banned subnets d6732d8 [tests] update disconnect_ban.py test case to work with listbanned (John Newbery) 77c54b2 [net] listbanned RPC and QT should show correct banned subnets (John Newbery) Tree-SHA512: edd0e43377d456260d2697213c2829f8483630f3a668b6707d52605faefa610d951d10e6f22a95eff483cbd14faa8ac9b69fa7d3c0b5735c5f3df23fd71282e0
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:
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.
This PR also adds a test to nodehandling to test the behaviour.
@jonasschnelli @sdaftuar