feat(protocol): Early Bitcoin refund #344
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Concept
If Alice has decided against locking her Monero, she can refund his Bitcoin for him immediately without having to wait for the timelock to expire. This is useful if:
TxLock
does not allow it to get into a block within one hourOn a technical level this works the following way:
tx_early_refund
) which spends the output created bytx_lock
to a single output owned by the Bitcoin refund address of Bob. Bob signs his half of the PSBT and transmits his signature to Alice. Alice stores the signature.tx_early_refund
with her private keyThis is safe because:
tx_early_refund
if she has not locked her Monero. If she were to publishtx_early_refund
and lock her Monero, she won't be able to recover the Monero (unless Bob gives her the keys)Notable changes:
EarlyRefundable
andEarlyRefunded
states are added for AliceEarlyRefunded
state is added for Bob in which he transitions when he discover thetx_early_refund
in the mempool