Skip to content

Commit 6b8fcc5

Browse files
committed
loopin: rename to persistAndAnnounceState
1 parent 60b907a commit 6b8fcc5

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

loopin.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ func (s *loopInSwap) executeSwap(globalCtx context.Context) error {
333333
// HtlcPublished state directly and wait for
334334
// confirmation.
335335
s.setState(loopdb.StateHtlcPublished)
336-
err = s.persistState(globalCtx)
336+
err = s.persistAndAnnounceState(globalCtx)
337337
if err != nil {
338338
return err
339339
}
@@ -376,7 +376,7 @@ func (s *loopInSwap) executeSwap(globalCtx context.Context) error {
376376
}
377377

378378
// Persist swap outcome.
379-
if err := s.persistState(globalCtx); err != nil {
379+
if err := s.persistAndAnnounceState(globalCtx); err != nil {
380380
return err
381381
}
382382

@@ -452,7 +452,7 @@ func (s *loopInSwap) publishOnChainHtlc(ctx context.Context) (bool, error) {
452452
// Verify whether it still makes sense to publish the htlc.
453453
if blocksRemaining < MinLoopInPublishDelta {
454454
s.setState(loopdb.StateFailTimeout)
455-
return false, s.persistState(ctx)
455+
return false, s.persistAndAnnounceState(ctx)
456456
}
457457

458458
// Get fee estimate from lnd.
@@ -466,7 +466,7 @@ func (s *loopInSwap) publishOnChainHtlc(ctx context.Context) (bool, error) {
466466
// Transition to state HtlcPublished before calling SendOutputs to
467467
// prevent us from ever paying multiple times after a crash.
468468
s.setState(loopdb.StateHtlcPublished)
469-
err = s.persistState(ctx)
469+
err = s.persistAndAnnounceState(ctx)
470470
if err != nil {
471471
return false, err
472472
}
@@ -590,7 +590,7 @@ func (s *loopInSwap) waitForSwapComplete(ctx context.Context,
590590
// accounting data.
591591
if s.state == loopdb.StateHtlcPublished {
592592
s.setState(loopdb.StateInvoiceSettled)
593-
err := s.persistState(ctx)
593+
err := s.persistAndAnnounceState(ctx)
594594
if err != nil {
595595
return err
596596
}
@@ -690,8 +690,9 @@ func (s *loopInSwap) publishTimeoutTx(ctx context.Context,
690690
return nil
691691
}
692692

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 {
695696
// Update state in store.
696697
err := s.store.UpdateLoopIn(
697698
s.hash, s.lastUpdateTime,

0 commit comments

Comments
 (0)