@@ -333,7 +333,7 @@ func (s *loopInSwap) executeSwap(globalCtx context.Context) error {
333
333
// HtlcPublished state directly and wait for
334
334
// confirmation.
335
335
s .setState (loopdb .StateHtlcPublished )
336
- err = s .persistState (globalCtx )
336
+ err = s .persistAndAnnounceState (globalCtx )
337
337
if err != nil {
338
338
return err
339
339
}
@@ -376,7 +376,7 @@ func (s *loopInSwap) executeSwap(globalCtx context.Context) error {
376
376
}
377
377
378
378
// Persist swap outcome.
379
- if err := s .persistState (globalCtx ); err != nil {
379
+ if err := s .persistAndAnnounceState (globalCtx ); err != nil {
380
380
return err
381
381
}
382
382
@@ -452,7 +452,7 @@ func (s *loopInSwap) publishOnChainHtlc(ctx context.Context) (bool, error) {
452
452
// Verify whether it still makes sense to publish the htlc.
453
453
if blocksRemaining < MinLoopInPublishDelta {
454
454
s .setState (loopdb .StateFailTimeout )
455
- return false , s .persistState (ctx )
455
+ return false , s .persistAndAnnounceState (ctx )
456
456
}
457
457
458
458
// Get fee estimate from lnd.
@@ -466,7 +466,7 @@ func (s *loopInSwap) publishOnChainHtlc(ctx context.Context) (bool, error) {
466
466
// Transition to state HtlcPublished before calling SendOutputs to
467
467
// prevent us from ever paying multiple times after a crash.
468
468
s .setState (loopdb .StateHtlcPublished )
469
- err = s .persistState (ctx )
469
+ err = s .persistAndAnnounceState (ctx )
470
470
if err != nil {
471
471
return false , err
472
472
}
@@ -590,7 +590,7 @@ func (s *loopInSwap) waitForSwapComplete(ctx context.Context,
590
590
// accounting data.
591
591
if s .state == loopdb .StateHtlcPublished {
592
592
s .setState (loopdb .StateInvoiceSettled )
593
- err := s .persistState (ctx )
593
+ err := s .persistAndAnnounceState (ctx )
594
594
if err != nil {
595
595
return err
596
596
}
@@ -690,8 +690,9 @@ func (s *loopInSwap) publishTimeoutTx(ctx context.Context,
690
690
return nil
691
691
}
692
692
693
- // persistState updates the swap state and sends out an update notification.
694
- func (s * loopInSwap ) persistState (ctx context.Context ) error {
693
+ // persistAndAnnounceState updates the swap state on disk and sends out an
694
+ // update notification.
695
+ func (s * loopInSwap ) persistAndAnnounceState (ctx context.Context ) error {
695
696
// Update state in store.
696
697
err := s .store .UpdateLoopIn (
697
698
s .hash , s .lastUpdateTime ,
0 commit comments