Commit Graph

12 Commits (84c3ef0402c389ebfa383f7a85173b553bb4420a)

Author SHA1 Message Date
Carla Kirk-Cohen 84c3ef0402
multi: update sweeping to allow different sighashes and claim scripts
Taproot spends require a different sighash, so we update our HtlcScript
interface to provide the appropriate sighash when sweeping. We also add
distinct Timeout/Success Script functions to allow for tapleaf spends
which have different locking scripts for different paths. Note that the
timeout and success paths will be the same for segwit v0 htlcs, because
it has a single branched script containing all spend paths.

In future iterations, this differentiation of claim scripts can also
be used to use musig2 to collaboratively keyspend P2TR htlcs with the
server. This script can be expressed as PriorityScript (because we'll
try to keyspend as a priority, and then fall back to a tap leaf spend).
As we've done here, segwit v0 spends would just return their single
script for PriorityScript, and the claim would be no different from
our other claims.
2 years ago
Carla Kirk-Cohen d29a0a8862
swap: add locking conditions to HtlcScript interface
Use of the Script() function is problematic when we introduce taproot
because our script will vary depending whether we use keyspend or a
tapleaf spend path (and on the tapleaf spent). This has not previously
been a problem for segwitv0 scripts, because they contain all of the
logical branches for each of our spend conditions in a single script.

This commit prepares for removal of the Script() function by moving
our address/pkScript/sigScript generation (which need Script()) into
each script's implementation of the HtlcScript interface so that
they have access to the script directly.
2 years ago
Carla Kirk-Cohen 1616943afe
swap: add taproot inputs to fee estimation 2 years ago
Harsha Goli d22b064e54
swap: HTLCV3 added
In this commit we add the version 3 htlc, which is implemented with
taproot script spending the two payment paths: the claim path case, and
the timeout case.
2 years ago
Carla Kirk-Cohen 9d2d5a78d4
multi: pass shared key to new htlc
TODO - our view etc functions don't have our shared key, find a good way
to get this. A possible solution is just to lazily store it so that we
don't need to call lnd/create a session every time we want to restore
it.
2 years ago
Harsha Goli 7a16e3b25d
multi: bump btcec/v2 and btcutil to new versions 2 years ago
Andras Banki-Horvath cd0a5f9f06
swap: extend swap to be able to create the V2 htlc 4 years ago
Andras Banki-Horvath 9fdd531130
swap: add HTLC script version 4 years ago
Andras Banki-Horvath 60661504a5 htlc: add string representation for HtlcOutputType enum 4 years ago
Joost Jager 753429547d
swap: fix htlc address generation
This commit fixes the generation of the htlc address. This bug didn't
affect the swap execution, because the htlc address is only used for
display to the user/caller.
5 years ago
Joost Jager 30c7d71c57
use np2wsh for loop in htlc 5 years ago
Olaoluwa Osuntokun f552bc06b1
utils: remove utils package in favor of new swap package 5 years ago