Open warioishere opened 1 week ago
confirmed, same error from Zap-O-Matic initiating a LN -> LBTC swap with Strike. It looks like their LBTC wallet is locked, but we only know about it after sending the 300 sats. Would expect either the pre-payment is conducted after an initial check with the node to ensure their wallet is ready, or that the fee is bounced back after this particular kind of failure in which the fee is not spent.
Thank you for reporting the issue.
Based on your suggestion, I think it is appropriate to check in advance when receiving a swap out request.
A GetOnchainBalance
check is performed in the State_SwapOutReceiver_CreateSwap
state.
https://github.com/ElementsProject/peerswap/blob/b7070cac0bec85a308df8da46b0aead57c7d95d4/swap/actions.go#L382
However, since this check alone may not be sufficient in some cases, I am considering updating the process as follows:
Opening tx Construction and Signing
When a swap-out request is received, receiver should first construct and sign an on-chain transaction.
If the wallet is locked during this step, signing will fail, allowing us to detect issues at that point. This will help prevent problems caused by wallet lock states like those you reported.
Reference link: signmessage RPC
testmempoolaccept
Additionally, to verify whether the transaction can be broadcasted successfully, we will use testmempoolaccept
. If any issues arise during this step, an error will be returned at that point, preventing inaccurate swap processing.
I thik these improvements will reduce the risk.
However, even with this approach, it does not completely prevent cases where only prepayment is received and then a swap cancellation occurs afterward. For such abuse cases, there is already a mechanism within the system that records as "suspicious peer."
I just created a swap with strike and got an error message from their side:
this already happend in the past but I didnt realize it that time, now I see theres defintiv a bug, or a missbevavior as ps shouldnt pay fees if the swap might fail.
PS probably needs a pre-check to validate that the swap would work.
maybe @Impa10r and @zapomatic can explain it better, because they also experience this bug already.