Skip to content

Commit 903266a

Browse files
authored
Merge pull request #892 from hieblmi/resign-withdrawal
staticaddr: allow rbf'ing withdrawal transactions
2 parents 3d1ba4e + b5af507 commit 903266a

File tree

2 files changed

+231
-64
lines changed

2 files changed

+231
-64
lines changed

staticaddr/deposit/fsm.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ func (f *FSM) DepositStatesV0() fsm.States {
297297
Withdrawing: fsm.State{
298298
Transitions: fsm.Transitions{
299299
OnWithdrawn: Withdrawn,
300+
// OnWithdrawInitiated is sent if a fee bump was
301+
// requested and the withdrawal was republished.
302+
OnWithdrawInitiated: Withdrawing,
300303
// Upon recovery, we go back to the Deposited
301304
// state. The deposit by then has a withdrawal
302305
// address stamped to it which will cause it to
@@ -358,7 +361,8 @@ func (f *FSM) DepositStatesV0() fsm.States {
358361
},
359362
Withdrawn: fsm.State{
360363
Transitions: fsm.Transitions{
361-
OnExpiry: Expired,
364+
OnExpiry: Expired,
365+
OnWithdrawn: Withdrawn,
362366
},
363367
Action: f.FinalizeDepositAction,
364368
},
@@ -374,11 +378,6 @@ func (f *FSM) updateDeposit(ctx context.Context,
374378
return
375379
}
376380

377-
f.Debugf("NextState: %v, PreviousState: %v, Event: %v",
378-
notification.NextState, notification.PreviousState,
379-
notification.Event,
380-
)
381-
382381
type checkStateFunc func(state fsm.StateType) bool
383382
type setStateFunc func(state fsm.StateType)
384383
checkFunc := checkStateFunc(f.deposit.IsInState)
@@ -393,6 +392,11 @@ func (f *FSM) updateDeposit(ctx context.Context,
393392
return
394393
}
395394

395+
f.Debugf("NextState: %v, PreviousState: %v, Event: %v",
396+
notification.NextState, notification.PreviousState,
397+
notification.Event,
398+
)
399+
396400
err := f.cfg.Store.UpdateDeposit(ctx, f.deposit)
397401
if err != nil {
398402
f.Errorf("unable to update deposit: %w", err)

0 commit comments

Comments
 (0)