fix: run t1 handler on xmrmaker ongoing swap restart (#457)

This commit is contained in:
noot
2023-05-03 14:59:46 -04:00
committed by GitHub
parent 2143df291b
commit 3d353340dc
2 changed files with 9 additions and 0 deletions

View File

@@ -192,6 +192,13 @@ func (s *swapState) runT1ExpirationHandler() {
time.Until(s.t1).Seconds(),
)
if time.Until(s.t2) < 0 {
log.Debugf("t2 (%s) has already passed; not starting t1 expiration handler",
s.t2.Format(common.TimeFmtSecs),
)
return
}
waitCtx, waitCtxCancel := context.WithCancel(context.Background())
defer waitCtxCancel() // Unblock WaitForTimestamp if still running when we exit

View File

@@ -317,6 +317,8 @@ func newSwapStateFromOngoing(
s.pubkeys = sk.PublicKeyPair()
s.contractSwapID = ethSwapInfo.SwapID
s.contractSwap = ethSwapInfo.Swap
go s.runT1ExpirationHandler()
return s, nil
}