Commit Graph

31 Commits (master)

Author SHA1 Message Date
Slyghtning fdf77ed56d
swap: address family for static addresses 3 months ago
shuoer86 921bdf05bd
fix typo swap/htlc.go 4 months ago
Slyghtning 5e91c446b8
loopd: abandon loop-ins 5 months ago
Oliver Gugger 08026dab93
multi: update linter, fix issues 7 months ago
sputn1ck 5454442771
swap: decide on actual keyfamily value
This commit decides on the actual key family value.
1 year ago
Andras Banki-Horvath e8cfe4cea9
swap: pass in MuSig2 version when creating taproot HTLCs
This commit adds the MuSig2 version as an input parameter when creating
Taproot htlcs. This will allow us to create both old and new MuSig2
Taproot HTLCs correctly.
1 year ago
sputn1ck 4baf88c414
multi: fix linter issues
This commit fixes outstanding linter issues, that we're not found by
running `make lint` locally. The linter issues were found by running
`docker run -v $(pwd):/build loop-tools golangci-lint run --whole-files`

I added the `revive` to the excludes as it would be to much of a
refactor and IMO seems unneccesary. E.g.
`interface.go:222:6: exported: type name will be used as
loop.LoopInTerms by other packages, and that stutters; consider
 calling this InTerms (revive)`. I think `loop.LoopInTerms` is fine.
1 year ago
Andras Banki-Horvath 049b17ff96
misc: refactor loop tests to use require where possible 1 year ago
Andras Banki-Horvath bdb4b773ed
swap: refactor htlc construction to allow passing of internal keys
This commit is a refactor of how we construct htlcs to make it possible
to pass in internal keys for the sender and receiver when creating P2TR
htlcs. Furthermore the commit also cleans up constructors to not pass in
script versions and output types to make the code more readable.
1 year ago
Andras Banki-Horvath 88956455b4
multi: completely remove support for NP2WSH htlcs
This commit removes all code related to NP2WSH htlcs. These were
historically used when segwit adoption was very sporadic and are not
used anywhere anymore. Some historical swaps stored in the DB may be
listed with incorrect htlc adresses from here on.
1 year ago
Andras Banki-Horvath 82b58e5c0e
loopout: attempt cooperative musig2 sweep
This commit adds optional cooperative musig2 sweep by calling the server
to create a partial signature for the sweep if we'd otherwise be allowed
to spend the htlc. If the cooperative musig2 spend fails, we always fall
back to use the scriptpath spend.
2 years ago
Andras Banki-Horvath bf59159ddb
client: LoopOutQuote to support estimate using v3 htlc 2 years ago
Carla Kirk-Cohen c7ef4297c0
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
Andras Banki-Horvath 9610becebd
multi: add the aggregate internal pubkey to the v3 htlc 2 years ago
Carla Kirk-Cohen 638973dce2
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
Oliver Gugger d5952f1202
multi: bump all dependency to use lnd 0.15.0-beta.rc4
This commit bumps all dependencies to be in line with what's required
for the current release candidate of lnd 0.15.0-beta.
2 years ago
sputn1ck a1271fee40
multi: fix linter issues 2 years ago
Harsha Goli dec6dd7e70
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
Harsha Goli 7a16e3b25d
multi: bump btcec/v2 and btcutil to new versions 2 years ago
Andras Banki-Horvath ffd52aba2f
loopout: add low/high routing plugin 2 years ago
Andras Banki-Horvath 1943edfd78
loopout: use optional routing plugin for the main swap invoice 2 years ago
Andras Banki-Horvath 64991813ed
test: spend tests for the new v2 htlc 4 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
Joost Jager 0c9fcd790e
lndclient: move to github.com/lightninglabs/lndclient 4 years ago
Andras Banki-Horvath 60661504a5 htlc: add string representation for HtlcOutputType enum 4 years ago
Oliver Gugger 69f2af9fdc
loop+cmd: extract types into swap module 5 years ago
Bjorn Olav Jalborg 8d7a272fdd loop+loopout: validate hash of swap invoice
This commit fixes a possible exploit by the loop server, where
- in a loop out - the server could claim money off-chain, without
publishing an on-chain swap htlc.

The server could do this by responding with a regular invoice, whose hash
is different than the hash in the NewLoopOutSwap request. To prevent
the exploit, we validate that the hash of the swap invoice is equal to the
hash the client generated.
5 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