Compare commits

...

4 Commits

Author SHA1 Message Date
bugmaker9371 d33787e4d9
Merge f8b5fe3c3d into 5e1a39d67f 2024-11-24 21:55:46 -08:00
Daniel Liu 5e1a39d67f
internal/flags: fix "flag redefined" bug for alias on custom flags (#30796)
This change fixes a bug on the `DirectoryFlag` and the `BigFlag`, which would trigger a `panic` with the message "flag redefined" in case an alias was added to such a flag.
2024-11-24 20:09:38 +01:00
Felix Lange f8b5fe3c3d p2p/discover: fix setting localnode port in startLocalhostV5 2024-05-28 21:32:22 +02:00
bugmaker9371 56cafb22ca p2p/discover: fix bug in `checkNodesEqual` 2024-05-28 20:21:46 +02:00
3 changed files with 5 additions and 3 deletions

View File

@ -90,7 +90,7 @@ func (f *DirectoryFlag) Apply(set *flag.FlagSet) error {
}
}
eachName(f, func(name string) {
set.Var(&f.Value, f.Name, f.Usage)
set.Var(&f.Value, name, f.Usage)
})
return nil
}
@ -172,7 +172,7 @@ func (f *BigFlag) Apply(set *flag.FlagSet) error {
}
eachName(f, func(name string) {
f.Value = new(big.Int)
set.Var((*bigValue)(f.Value), f.Name, f.Usage)
set.Var((*bigValue)(f.Value), name, f.Usage)
})
return nil
}

View File

@ -239,6 +239,8 @@ func checkNodesEqual(got, want []*enode.Node) error {
goto NotEqual
}
}
} else {
return fmt.Errorf("length dismatch: got %d nodes, want %d nodes", len(got), len(want))
}
return nil

View File

@ -90,7 +90,7 @@ func startLocalhostV5(t *testing.T, cfg Config) *UDPv5 {
}
realaddr := socket.LocalAddr().(*net.UDPAddr)
ln.SetStaticIP(realaddr.IP)
ln.Set(enr.UDP(realaddr.Port))
ln.SetFallbackUDP(realaddr.Port)
udp, err := ListenV5(socket, ln, cfg)
if err != nil {
t.Fatal(err)