-
Notifications
You must be signed in to change notification settings - Fork 38.7k
[Fix] Allow connection of a noban banned peer #16618
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
|
Is this safe to do? What are the implications of connecting to a peer that would otherwise be banned? |
|
@Gapeman afaik that was the behavior before #16248 (which was not supposed to change existing behavior). @NicolasDorier would be nice to have a test for this. |
c5ea3bd to
72bf177
Compare
|
I refactored it to properly scope some variables. Writing a test so such regression can't happen. |
f235f8c to
4062967
Compare
|
Fixed the bug, and added an anti regression test for |
4062967 to
a0d2e2b
Compare
|
utACK a0d2e2b |
Sjors
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.
Travis failed due to lint issue. Maybe rename rpc_setban.py to p2p_whitelist.py?
test/functional/rpc_setban.py
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.
Maybe pass node in directly and split into assert_has_permission(self, node, permission) and assert_has_no_permission(self, node, permission)
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.
what about assert_equal(True, self.hasPermision(...)) ?
That said, I don't think it should pass the nodes to this method. It is confusing (there is two nodes: the node that is permissioned, and the node on which we want to check permissions).
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.
assert(self.hasPermision(...)) is even simpler.
You could pass both nodes. Or you could document at the top of the test file which hardcoded nodes do what.
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.
Sorry but I think you could just inline this - it's longer as it is with the contains arg.
a0d2e2b to
b3e2a6e
Compare
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.
ACK
test/functional/rpc_setban.py
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.
Sorry but I think you could just inline this - it's longer as it is with the contains arg.
b3e2a6e to
50590a3
Compare
|
As @promag suggested, I instead just inlined the permission checked, it is actually more readable. I also check in the logs that we really prevent connection because of the ban. I also added a test to |
769edfa to
a825d91
Compare
|
@Sjors |
a825d91 to
d117f45
Compare
|
Agree inline is more clear. utACK d117f45 |
|
ACK d117f45 Show signature and timestampSignature: Timestamp of file with hash |
d117f45 Add test for setban (nicolas.dorier) dc7529a [Fix] Allow connection of a noban banned peer (nicolas.dorier) Pull request description: Reported by @MarcoFalke on bitcoin#16248 (comment) The bug would mean that if the peer connecting to you is banned, but whitelisted without specific permissions, it would not be able to connect to the node. The solution is just to move the same line below. ACKs for top commit: Sjors: Agree inline is more clear. utACK d117f45 MarcoFalke: ACK d117f45 Tree-SHA512: 0fed39acb1e8db67bb0bf4c4de3ad034ae776f38d55bd661f1ae0e1a4c6becaf1824ab46ed8279f2f31df3f4b29ff56461d8b167d3e9cece62cfe58b5a912811
Github-Pull: bitcoin#16618 Rebased-From: dc7529a
Github-Pull: bitcoin#16618 Rebased-From: d117f45
Summary: * Add test for setban This is a backport of Core [[bitcoin/bitcoin#16618 | PR16618]] Test Plan: ninja all check-all Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D5935
Summary: * Add test for setban This is a backport of Core [[bitcoin/bitcoin#16618 | PR16618]] Test Plan: ninja all check-all Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D5935
d117f45 Add test for setban (nicolas.dorier) dc7529a [Fix] Allow connection of a noban banned peer (nicolas.dorier) Pull request description: Reported by @MarcoFalke on bitcoin#16248 (comment) The bug would mean that if the peer connecting to you is banned, but whitelisted without specific permissions, it would not be able to connect to the node. The solution is just to move the same line below. ACKs for top commit: Sjors: Agree inline is more clear. utACK d117f45 MarcoFalke: ACK d117f45 Tree-SHA512: 0fed39acb1e8db67bb0bf4c4de3ad034ae776f38d55bd661f1ae0e1a4c6becaf1824ab46ed8279f2f31df3f4b29ff56461d8b167d3e9cece62cfe58b5a912811
Reported by @MarcoFalke on #16248 (comment)
The bug would mean that if the peer connecting to you is banned, but whitelisted without specific permissions, it would not be able to connect to the node.
The solution is just to move the same line below.