go-ethereum
go-ethereum copied to clipboard
beacon,console,core,eth,p2p,rpc: keep `wg.Add` and `wg.Done` closer
Similar to #29813, this PR modifies all other sync.WaitGroup
cases.
- call
wg.Done
withoutwg.Add
will cause panic. -
wg.Done()
is meaningless withoutwg.Add
and goroutine - Putting
wg.Add
andwg.Done
together can makes us easily ensure that both counts are equal.