Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
[net] listbanned RPC and QT should show correct banned subnets #10234
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 ea2c925 |
Right. If you think that's ok, then calling sweep from with |
fanquake
added the
P2P
label
Apr 19, 2017
luke-jr
added a commit
to bitcoinknots/bitcoin
that referenced
this pull request
Apr 21, 2017
|
|
jnewbery + luke-jr |
266df5f
|
luke-jr
added a commit
to bitcoinknots/bitcoin
that referenced
this pull request
Apr 21, 2017
|
|
jnewbery + luke-jr |
f52e925
|
|
Needs rebase |
|
Discussion on IRC: the |
|
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. |
|
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. |
laanwj
merged commit d6732d8
into
bitcoin:master
May 2, 2017
1 check passed
laanwj
added a commit
that referenced
this pull request
May 2, 2017
|
|
laanwj |
faf2dea
|
jnewbery
deleted the
jnewbery:list_banned_correctly branch
May 2, 2017
jnewbery
referenced
this pull request
May 9, 2017
Merged
[tests] fix disconnect_ban intermittency #10376
luke-jr
added a commit
to luke-jr/bitcoin
that referenced
this pull request
Jun 3, 2017
|
|
jnewbery + luke-jr |
2d4c2cf
|
luke-jr
added a commit
to luke-jr/bitcoin
that referenced
this pull request
Jun 3, 2017
|
|
jnewbery + luke-jr |
322e904
|
luke-jr
added a commit
to luke-jr/bitcoin
that referenced
this pull request
Jun 5, 2017
|
|
jnewbery + luke-jr |
2f2e8d7
|
luke-jr
added a commit
to luke-jr/bitcoin
that referenced
this pull request
Jun 5, 2017
|
|
jnewbery + luke-jr |
fff3d6f
|
luke-jr
added a commit
to luke-jr/bitcoin
that referenced
this pull request
Jun 5, 2017
|
|
jnewbery + luke-jr |
7033da5
|
luke-jr
added a commit
to luke-jr/bitcoin
that referenced
this pull request
Jun 5, 2017
|
|
jnewbery + luke-jr |
963176b
|
luke-jr
added a commit
to luke-jr/bitcoin
that referenced
this pull request
Jun 5, 2017
|
|
luke-jr |
2873484
|
luke-jr
added a commit
to luke-jr/bitcoin
that referenced
this pull request
Jun 5, 2017
|
|
jnewbery + luke-jr |
d289b56
|
luke-jr
added a commit
to luke-jr/bitcoin
that referenced
this pull request
Jun 5, 2017
|
|
jnewbery + luke-jr |
ee1a60d
|
luke-jr
added a commit
to luke-jr/bitcoin
that referenced
this pull request
Jun 5, 2017
|
|
luke-jr |
e05799a
|
nomnombtc
added a commit
to nomnombtc/bitcoin
that referenced
this pull request
Jul 17, 2017
|
|
jnewbery + nomnombtc |
d5bd983
|
nomnombtc
added a commit
to nomnombtc/bitcoin
that referenced
this pull request
Jul 17, 2017
|
|
jnewbery + nomnombtc |
c8b124d
|
jnewbery commentedApr 19, 2017
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