SatoshiPortal / boltz-rust

Boltz client rust crate
https://docs.boltz.exchange
30 stars 16 forks source link

`transaction.refunded` swap state not covered #42

Closed ok300 closed 2 months ago

ok300 commented 2 months ago

The swap state transaction.refunded is not covered by the SubSwapStates enum:

https://github.com/SatoshiPortal/boltz-rust/blob/cf2544ae126ac46ab2118313d61a57f160e3d64e/src/swaps/boltz.rs#L332-L340

According to the Boltz docs^1:

If the user successfully set up the Lightning payment and Boltz successfully locked up bitcoin on the chain, but the Boltz API Client did not claim the locked chain bitcoin until swap expiry, Boltz will automatically refund its own locked chain Bitcoin. The final status of such a swap will be transaction.refunded.

This leads to a parsing error when parsing the state of a swap with this status.

i5hi commented 2 months ago

transaction.refunded is only part of ReverseSwap. Thats where boltz does the lockup transaction.

Client does the lockup for SubmarineSwap and potentially needs to refund it. The final states for submarine are invoice.failedToPay and swap.expired

ok300 commented 2 months ago

It is not part of the enum.

When Boltz returns the swap state as transaction.refunded, fetching the swap state via boltz-rust results in a parsing error on the client side.

ok300 commented 2 months ago

Turns out you're right, the enum RevSwapStates::TransactionRefunded covers that state.

We were using the wrong enum SubSwapStates which doesn't reflect that state.