p2p/discover: fix deadlock in waitForNodes by buffering subscriber channel

This commit is contained in:
Vansh Sahay 2026-05-06 20:47:01 +05:30
parent aaa2b66285
commit d15e833a43
No known key found for this signature in database

View file

@ -769,7 +769,7 @@ func (tab *Table) waitForNodes(ctx context.Context, n int) error {
}
if ch == nil {
// Init subscription.
ch = make(chan *enode.Node)
ch = make(chan *enode.Node, 1)
sub := tab.nodeFeed.Subscribe(ch)
defer sub.Unsubscribe()
}