loopin: extract persistState

pull/240/head
Joost Jager 4 years ago
parent 6b8fcc547c
commit e33d2fb762
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7

@ -694,19 +694,23 @@ func (s *loopInSwap) publishTimeoutTx(ctx context.Context,
// update notification.
func (s *loopInSwap) persistAndAnnounceState(ctx context.Context) error {
// Update state in store.
err := s.store.UpdateLoopIn(
if err := s.persistState(); err != nil {
return err
}
// Send out swap update
return s.sendUpdate(ctx)
}
// persistState updates the swap state on disk.
func (s *loopInSwap) persistState() error {
return s.store.UpdateLoopIn(
s.hash, s.lastUpdateTime,
loopdb.SwapStateData{
State: s.state,
Cost: s.cost,
},
)
if err != nil {
return err
}
// Send out swap update
return s.sendUpdate(ctx)
}
// setState updates the swap state and last update timestamp.

Loading…
Cancel
Save