Atomic Swap - What if redeem is done just before expiration

1

As per the explanation provided here: https://github.com/decred/atomicswap

The contract is valid for a certain amount of time (example set to 48h) and in order for the party B to recover the found, he needs the secret that is published on the chain after the party A has redeem the coins on the contract.

As far as I understand, it takes some time for party B to actually recover the secret from the chain and then redeem the coins.

What happens if party A wait last seconds (let's say 5 seconds) before expiration of the contract to redeem the coin, which wouldn't provide enough time for party B to redeem its coin before the contract expiration in which case it would be refunded to party A as well as getting party B coins.

Is the understanding correct and that point valid?

Is it fixable by setting different contract expiration period, lets say party A contract would need longer expiration time to ensure party B ha time to redeem the coins?

Damien

Posted 2018-04-11T13:17:23.123

Reputation: 111

Answers

1

As you stated, setting 2 different expiration times provides safety.

My recommendation is to select the network with the longest period before immutability as the first contract, and pick a time that is agreeable with both parties.

The second contract on the other chain should use an expiry that is half of the first contract. This gives the redeemer on the first blockchain some time before the expiry.

jmjatlanta

Posted 2018-04-11T13:17:23.123

Reputation: 86

0

Before that 48 hours passes, one can't refund funds. The only thing s/he can do is to wait for the initiator to redeem coins.

After the locktime ends, one becomes able to get a refund. However, you're still able to redeem coins.

So, you're still able to redeem coins after the locktime.

MCCCS

Posted 2018-04-11T13:17:23.123

Reputation: 5 827

This is understood, however, the question is a bit different. it describes a potential attackDamien 2018-04-11T16:07:01.853