ElementsProject / ElementsProject/peerswap-spec
Provide onchain UTXOs early (`swap_in_request` and `swap_out_agreement`) for early abort
- Dominant language
- No language data
- Stars
- 6
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
In some cases, a node offering peerswap services may be located or under a jurisdiction which legally requires sanctioning particular UTXos or addresses. Such a node would, with the current protocol, reject such UTXOs "late", i.e. when the transaction spending such a UTXO has already been spent into the onchain HTLC, thus forcing the onchain HTLC maker to use an expensive funds recovery on abort.
By adding a list of UTXOs in the `swap_in_request` and `swap_out_agreement`, the receiver of the onchain funds can inspect the UTXOs before the onchain HTLC is instantiated. So while it has to still reject the swap, at least the rejection is "early", before the sender of the onchain HTLC has created and broadcasted a transaction that spends those UTXOs.
My proposal is to add an array of strings (if using JSON format still) or a variable-length field, `planned_utxos`, to both `swap_in_request` and `swap_out_agreement`.
The receiver of `swap_in_request` or `swap_out_agreement` would have:
* MUST check that all `planned_utxos` are not UTXOs it cannot legally accept, if the receiver is in a jurisdiction that imposes legal sanctions on particular UTXOs.
Then, in the section "Doing the Swap", for the receiver of the `opening_tx_broadcast` message, we would add the clause:
* MUST check that the transaction spends exactly the `planned_utxos` from the previous `swap_in_request` or `swap_out_agreement`. The transaction inputs MUST be validated in the same order as `planned_utxos`.
This feature affects forwardable peerswaps. If the node you are forwarding to is in a jurisdiction that requires legal sanctioning of particular UTXOs, then it is best to ask them early so you have an opportunity to select a different next hop that might accept the proposed UTXOs.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.