Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receive Chain Swap: support refund even when lockup address is re-used #471

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

ok300
Copy link
Contributor

@ok300 ok300 commented Sep 4, 2024

Fixes #432

Copy link
Member

@roeierez roeierez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ok300 ok300 force-pushed the ok300-receive-chain-swap-address-reuse branch 2 times, most recently from f15df31 to 11c0adb Compare September 13, 2024 10:19
@ok300 ok300 changed the base branch from main to ok300-yse-refund-loop-fix September 13, 2024 10:19
@ok300 ok300 force-pushed the ok300-receive-chain-swap-address-reuse branch from 11c0adb to c25de91 Compare September 13, 2024 13:08
@ok300 ok300 changed the base branch from ok300-yse-refund-loop-fix to yse-refund-loop-fix September 13, 2024 13:09
@hydra-yse hydra-yse force-pushed the yse-refund-loop-fix branch 2 times, most recently from 9090ef9 to c8de986 Compare September 18, 2024 13:27
@ok300 ok300 force-pushed the ok300-receive-chain-swap-address-reuse branch from c25de91 to d2eae3f Compare September 20, 2024 16:06
@ok300 ok300 changed the base branch from yse-refund-loop-fix to main September 20, 2024 16:07
Copy link
Collaborator

@hydra-yse hydra-yse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

lib/core/src/sdk.rs Outdated Show resolved Hide resolved
info!("Successfully broadcast refund for incoming Chain Swap {id}, is_cooperative: {is_cooperative}");

// After refund tx is broadcasted, set the payment state to `RefundPending`. This ensures:
// - the swap is not shown in `list-refundables` anymore
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's my understanding that this PR fixes that the refundable swap is no longer shown in list_refundables. I have two questions, after executing a refund:

  1. Is the payment shown with the refund_tx_id in list_payments?
  2. Is it possible to broadcast another tx to effectively bump the fee?

My concern is the swap is no longer refundable if broadcasting the refund with too low a fee

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the payment shown with the refund_tx_id in list_payments?

Yes.

Is it possible to broadcast another tx to effectively bump the fee?

Only for cooperative refunds. The non-coop refunds don't have RBF enabled.

However there is no timeout after which cooperative refunds are impossible. The only way I could test non-cooperative refunds was by commenting out the coop refund call. Boltz participated in the coop refund even weeks after a swap failed.

My concern is the swap is no longer refundable if broadcasting the refund with too low a fee

From what I can tell, this can only happen if

  1. Boltz is not reachable for the coop refund and
  2. the user chooses a feerate that is too low

IMO this is unlikely because of the 1st point.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only for cooperative refunds. The non-coop refunds don't have RBF enabled

I tried on main branch to do this, but I get a "No UTXO found" error. Probably because the electrum script_list_unspent excludes them "Any output that is spent in the mempool does not appear"

Boltz participated in the coop refund even weeks after a swap failed

I think Boltz will always try to cooperate with a refund (always if the lockup failed or if the swap expired after they refund themselves). So it's more doomsday handling

Copy link
Collaborator

@dangeross dangeross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Can you make an issue to handle increasing the fee based on an already broadcast refund tx? As discussed in the dev call

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support address re-use in Receive Chain Swap
4 participants