diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index 8131f90e..74d7f568 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -690,9 +690,7 @@ func (s *Switch) ForwardPackets(linkQuit chan struct{}, func (s *Switch) proxyFwdErrs(num *int, wg *sync.WaitGroup, fwdChan, errChan chan error) { defer s.wg.Done() - defer func() { - close(errChan) - }() + defer close(errChan) // Wait here until the outer function has finished persisting // and routing the packets. This guarantees we don't read from num until