mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/devp2p: exit when lookup iterator ends
This commit is contained in:
parent
ca8c445c4b
commit
c592367d0b
1 changed files with 7 additions and 1 deletions
|
|
@ -121,9 +121,15 @@ func discv4RandomNodes(ctx *cli.Context) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer disc.Close()
|
||||
|
||||
iter := disc.RandomNodes()
|
||||
for {
|
||||
fmt.Println(iter.NextNode(context.Background()))
|
||||
n, ok := iter.NextNode(context.Background())
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
fmt.Println(n)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue