Open
Conversation
holisticode
reviewed
Apr 14, 2023
holisticode
left a comment
There was a problem hiding this comment.
What's the difference of this PR to #44?
Merged
Author
My bad, I forgot to push few files. Now it should look fine. |
holisticode
reviewed
Apr 18, 2023
| cleanupInterval = 1 * time.Second | ||
| en1, _ := enode.Parse(enode.ValidSchemes, "enode://969654fc30f10e45903ee2d107cfc165feaff6f9acbd2a9472120a3581f7c717ded76113aa116e35b8389dfcc9129ecfc85a409f6c46fc864ce077cb85316ac8@3.252.226.57:5050") | ||
| BanStatic(en1.ID()) | ||
| time.Sleep(2 * time.Second) |
There was a problem hiding this comment.
Seeing that in the other PR you significantly reduced the Sleep time - wondering if you could do this here too?
| cleanupInterval = 1 * time.Second | ||
| en1, _ := enode.Parse(enode.ValidSchemes, "enode://969654fc30f10e45903ee2d107cfc165feaff6f9acbd2a9472120a3581f7c717ded76113aa116e35b8389dfcc9129ecfc85a409f6c46fc864ce077cb85316ac8@3.252.226.57:5050") | ||
| BanDynamic(en1.ID(), 1*time.Second) // remove the entry after 1 second | ||
| time.Sleep(2 * time.Second) |
| func TestStaticBan(t *testing.T) { | ||
| Enable() | ||
| cleanupInterval = 1 * time.Second | ||
| en1, _ := enode.Parse(enode.ValidSchemes, "enode://969654fc30f10e45903ee2d107cfc165feaff6f9acbd2a9472120a3581f7c717ded76113aa116e35b8389dfcc9129ecfc85a409f6c46fc864ce077cb85316ac8@3.252.226.57:5050") |
There was a problem hiding this comment.
Does this node exist? If so, could we maybe just use a fake enode? The test just checks the ID...
| } | ||
|
|
||
| func BannedDynamic(id enode.ID) bool { | ||
| func BanDynamic(id enode.ID, banInterval time.Duration) { |
There was a problem hiding this comment.
I don't see this new function being used other than in the test, is that intentional?
holisticode
approved these changes
Apr 27, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for Static and Dynamic bans.
A static ban means that the peer will b banned until the node is restarted.
The dynamic ban means that the peer will be banned for 4 hours.
This PR depends on #44.
Once #44 is merged, this PR should be rebased on top of that.