|
|
|
@ -103,7 +103,7 @@ func NewFSM(ctx context.Context, deposit *Deposit, cfg *ManagerConfig,
|
|
|
|
|
|
|
|
|
|
if recoverStateMachine {
|
|
|
|
|
depoFsm.StateMachine = fsm.NewStateMachineWithState(
|
|
|
|
|
depositStates, deposit.getState(),
|
|
|
|
|
depositStates, deposit.GetState(),
|
|
|
|
|
DefaultObserverSize,
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
@ -146,8 +146,8 @@ func (f *FSM) handleBlockNotification(currentHeight uint32) error {
|
|
|
|
|
|
|
|
|
|
// If the deposit is expired but not yet sufficiently confirmed, we
|
|
|
|
|
// republish the expiry sweep transaction.
|
|
|
|
|
if f.deposit.isExpired(currentHeight, params.Expiry) {
|
|
|
|
|
if f.deposit.isInState(WaitForExpirySweep) {
|
|
|
|
|
if f.deposit.IsExpired(currentHeight, params.Expiry) {
|
|
|
|
|
if f.deposit.IsInState(WaitForExpirySweep) {
|
|
|
|
|
f.PublishDepositExpirySweepAction(nil)
|
|
|
|
|
} else {
|
|
|
|
|
go func() {
|
|
|
|
@ -231,13 +231,13 @@ func (f *FSM) updateDeposit(notification fsm.Notification) {
|
|
|
|
|
notification.Event,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
f.deposit.setState(notification.NextState)
|
|
|
|
|
f.deposit.SetState(notification.NextState)
|
|
|
|
|
|
|
|
|
|
// Don't update the deposit if we are in an initial state or if we
|
|
|
|
|
// are transitioning from an initial state to a failed state.
|
|
|
|
|
d := f.deposit
|
|
|
|
|
if d.isInState(fsm.EmptyState) || d.isInState(Deposited) ||
|
|
|
|
|
(notification.PreviousState == Deposited && d.isInState(
|
|
|
|
|
if d.IsInState(fsm.EmptyState) || d.IsInState(Deposited) ||
|
|
|
|
|
(notification.PreviousState == Deposited && d.IsInState(
|
|
|
|
|
Failed,
|
|
|
|
|
)) {
|
|
|
|
|
|
|
|
|
|