Skip to content

Commit

Permalink
feat: allow send transition from TimedOut to Created (#545)
Browse files Browse the repository at this point in the history
  • Loading branch information
hydra-yse authored Nov 5, 2024
1 parent bf5d4a1 commit a515718
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/core/src/send_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,9 @@ impl SendSwapHandler {
to_state: PaymentState,
) -> Result<(), PaymentError> {
match (from_state, to_state) {
(TimedOut, Created) => Ok(()),
(_, Created) => Err(PaymentError::Generic {
err: "Cannot transition to Created state".to_string(),
err: "Cannot transition from {from_state:?} to Created state".to_string(),
}),

(Created | Pending, Pending) => Ok(()),
Expand Down Expand Up @@ -583,7 +584,7 @@ mod tests {
Pending,
HashSet::from([Pending, RefundPending, Complete, Failed]),
),
(TimedOut, HashSet::from([TimedOut, Failed])),
(TimedOut, HashSet::from([TimedOut, Created, Failed])),
(Complete, HashSet::from([])),
(Refundable, HashSet::from([Failed])),
(Failed, HashSet::from([Failed])),
Expand Down

0 comments on commit a515718

Please sign in to comment.