mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
multi: improve readability of goroutine defers
This commit fixes the readability of some of the defer calls in goroutines by making sure the defer stands out properly.
This commit is contained in:
parent
ad8e25cbc9
commit
55b53555e9
@ -1325,6 +1325,7 @@ func (d *AuthenticatedGossiper) networkHandler() {
|
||||
d.wg.Add(1)
|
||||
go func() {
|
||||
defer d.wg.Done()
|
||||
|
||||
log.Infof("Broadcasting %v new announcements in %d sub batches",
|
||||
len(announcementBatch), len(splitAnnouncementBatch))
|
||||
|
||||
@ -2947,6 +2948,7 @@ func (d *AuthenticatedGossiper) handleAnnSig(nMsg *networkMsg,
|
||||
d.wg.Add(1)
|
||||
go func() {
|
||||
defer d.wg.Done()
|
||||
|
||||
log.Debugf("Received half proof for channel "+
|
||||
"%v with existing full proof. Sending"+
|
||||
" full proof to peer=%x",
|
||||
|
@ -1969,6 +1969,7 @@ func (f *Manager) handleFundingAccept(peer lnpeer.Peer,
|
||||
f.wg.Add(1)
|
||||
go func() {
|
||||
defer f.wg.Done()
|
||||
|
||||
f.waitForPsbt(psbtIntent, resCtx, pendingChanID)
|
||||
}()
|
||||
|
||||
|
@ -1742,6 +1742,7 @@ func (s *Switch) htlcForwarder() {
|
||||
wg.Add(1)
|
||||
go func(l ChannelLink) {
|
||||
defer wg.Done()
|
||||
|
||||
l.Stop()
|
||||
}(link)
|
||||
}
|
||||
|
@ -405,6 +405,7 @@ func subscribeChannelNotifications(ctxb context.Context, t *harnessTest,
|
||||
chanUpdates := make(chan *lnrpc.ChannelEventUpdate, 20)
|
||||
go func() {
|
||||
defer cancelFunc()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-quit:
|
||||
|
@ -180,8 +180,9 @@ func (h *MiddlewareHandler) Run() error {
|
||||
// request to the client).
|
||||
h.wg.Add(1)
|
||||
go func() {
|
||||
defer h.wg.Done()
|
||||
|
||||
h.receiveResponses(errChan, responses)
|
||||
h.wg.Done()
|
||||
}()
|
||||
|
||||
return h.sendInterceptRequests(errChan, responses)
|
||||
|
@ -1415,6 +1415,7 @@ func (s *UtxoSweeper) waitForSpend(outpoint wire.OutPoint,
|
||||
s.wg.Add(1)
|
||||
go func() {
|
||||
defer s.wg.Done()
|
||||
|
||||
select {
|
||||
case spend, ok := <-spendEvent.Spend:
|
||||
if !ok {
|
||||
|
@ -39,6 +39,7 @@ func NewForce(interval time.Duration) *Force {
|
||||
m.wg.Add(1)
|
||||
go func() {
|
||||
defer m.wg.Done()
|
||||
|
||||
for {
|
||||
select {
|
||||
case t := <-m.ticker:
|
||||
|
@ -689,6 +689,7 @@ func (s *sessionQueueSet) ApplyAndWait(getApply func(*sessionQueue) func()) {
|
||||
wg.Add(1)
|
||||
go func(sq *sessionQueue) {
|
||||
defer wg.Done()
|
||||
|
||||
getApply(sq)()
|
||||
}(sessionq)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user