eth/protocols/eth: fix loading "eth" ENR key in dial filter (#31251)

This fixes an issue where dial candidates from discv5 would be ignored
because the "eth" ENR entry was not loaded correctly.
This commit is contained in:
Shude Li 2025-02-25 20:40:57 +08:00 committed by GitHub
parent f6883431c2
commit 756310fa43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -42,6 +42,7 @@ func StartENRUpdater(chain *core.BlockChain, ln *enode.LocalNode) {
var newHead = make(chan core.ChainHeadEvent, 10)
sub := chain.SubscribeChainHeadEvent(newHead)
ln.Set(currentENREntry(chain))
go func() {
defer sub.Unsubscribe()
for {
@ -71,7 +72,7 @@ func NewNodeFilter(chain *core.BlockChain) func(*enode.Node) bool {
filter := forkid.NewFilter(chain)
return func(n *enode.Node) bool {
var entry enrEntry
if err := n.Load(entry); err != nil {
if err := n.Load(&entry); err != nil {
return false
}
err := filter(entry.ForkID)