-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
p2p, p2p/discover: add signed ENR generation #17753
Conversation
p2p/netutil/iptrack.go
Outdated
it.gcContact(now) | ||
it.gcStatements(now) | ||
for host := range it.statements { | ||
if _, ok := it.contact[host]; !ok { |
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.
You should also return true if you have received the statement before the contact.
@zsfelfoldi PTAL |
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.
Looks good as far as I can tell
if ln.staticIP != nil { | ||
newIP = ln.staticIP | ||
} else if ip, port := predictAddr(ln.udpTrack); ip != nil { |
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.
Is it ok to use the static IP with the fallback UDP port? Shouldn't we add a StaticUDP parameter?
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.
It doesn't make sense because there is no way to set such a port via anything in geth.
I'm still debugging the hang in the tests on CI. The test that hangs is the swarm discovery simulation. |
LocalNode produces signed node records for the local node.
Startup is much faster because it doesn't need to wait for the external IP query anymore.
The discovery protocol sends pings to previously-unseen nodes after receiving a ping from them. This means there will always be a contact entry and PredictFullConeNAT will always return false. Fix it by checking that the contact occurred after the IP statement.
This makes the node URL in logs correct immediately after startup.
This prevents indefinite memory growth if Predict* isn't called.
This fixes a leveldb crash in tests.
This PR adds enode.LocalNode and integrates it into the p2p subsystem. This new object is the keeper of the local node record. For now, a new version of the record is produced every time the client restarts. We'll make it smarter to avoid that in the future. There are a couple of other changes in this commit: discovery now waits for all of its goroutines at shutdown and the p2p server now closes the node database after discovery has shut down. This fixes a leveldb crash in tests. p2p server startup is faster because it doesn't need to wait for the external IP query anymore.
This PR adds enode.LocalNode and integrates it into the p2p subsystem. This new object is the keeper of the local node record. For now, a new version of the record is produced every time the client restarts. We'll make it smarter to avoid that in the future. There are a couple of other changes in this commit: discovery now waits for all of its goroutines at shutdown and the p2p server now closes the node database after discovery has shut down. This fixes a leveldb crash in tests. p2p server startup is faster because it doesn't need to wait for the external IP query anymore.
This reverts commit 3ca7a7c.
This PR adds
enode.LocalNode
. This new object is the keeper of the local node record.For now, a new version of the record is produced every time the client restarts. We'll make it
smarter to avoid that in the future.