Commit Graph

36 Commits (master)

Author SHA1 Message Date
George Tsagkarelis 33fdde949f
loop: fix loopout and client tests for sweeper integration 2 months ago
George Tsagkarelis e0d85958f7
multi: move StoreMock to loopdb 2 months ago
sputn1ck 960a78be3d
protocol: set musig2 to be the stable version
This commit changes the stable protocol version to be the Musig2 protocol.
The experimental version is set to the stable version
in order for the flag to still work if a user has it set.
11 months ago
Andras Banki-Horvath 4d34eb97ce
build: fixup new linter issues 1 year ago
Andras Banki-Horvath cd91f90ed2
loop: use MuSig2 1.0 scheme for the new MuSig2 swaps 1 year ago
Andras Banki-Horvath da4bcbea10
loopdb: refactor the SwapContract to hold all HTLC keys
This commit adds a new struct to hold all HTLC keys and refactors the
SwapContract which is used by both loopin and loopout swaps to use this
new struct. The newly added internal keys will for now hold the script
keys to keep everything equivalent but are already stored and read back
if the protocol version is set to MuSig2.
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 391ef57ea3
loopout: enable p2tr without keyspend 2 years ago
Andras Banki-Horvath 152677fcc7
test: fix naming in client tests 2 years ago
Andras Banki-Horvath 9610becebd
multi: add the aggregate internal pubkey to the v3 htlc 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
carla d1c26a20da
multi: surface server swap initiation grpc error codes
Formatting our error was stifling any grpc error returned by the
server. Instead, we bubble up our grpc error, setting an unknown
code if the server did not specifically return an error code.
3 years ago
carla f166ce899d
loopout: cancel swap with server when off-chain fails 3 years ago
Oliver Gugger 2a732a4385
loop: add initiator string to user agent 3 years ago
Andras Banki-Horvath 98bdbcddfb tests: extend tests to also test resuming with HTLC v2 4 years ago
carla 852f459391
multi: add htlc confirmations parameter to client loop out request 4 years ago
carla 1877b7f08b
multi: store loop out htlc confirmations on disk
To allow users to specify differing confirmation targets, we store the
swap conf target per-swap. This makes us restart safe, so we do not
forget confirmation values for swaps that are in flight when we restart.
4 years ago
Joost Jager 68012f051a
loopout: create LoopOutSwapInfo struct 4 years ago
Joost Jager e22524a262
loopout: register for confirmation using htlc tx hash 4 years ago
Joost Jager 190caa4097
loopout/test: refactor test 4 years ago
Joost Jager 0c9fcd790e
lndclient: move to github.com/lightninglabs/lndclient 4 years ago
carla 65c847674d
multi: add preimage push to loop out after sweep attempt
Once we have revealed our preimage to the world with a sweep attempt,
we can safely push our preimage to the server to speed up on chain
claim.

Rather than rely on the server, we use the state of our invoice in lnd
to determine whether we should continue trying to push the preimage to
the server.
4 years ago
Oliver Gugger bf6f6b31f4
client: fix some comments 4 years ago
Joost Jager a05e46697d
test: assert raw output signing requests 4 years ago
Joost Jager 1b306ad425
loopdb: replace swap state enum by state data object
This commits lays down the foundation in the database for adding more
persistent state data to swaps.
5 years ago
Joost Jager 2e48ead6d6
loopd: loop in from external address
Allow user to specify that htlc will be published by an external source.
In that case no internal htlc tx will be published.

To facilitate sending to the htlc address, the swap initiation response
is extended with that address.
5 years ago
Joost Jager 6a0a9556a0
loopdb: add loop in
This commit adds the required code to persist loop in swaps. It also
introduces the file loop.go to which shared code is moved.

Sharing of contract serialization/deserialization code has been
reverted. The prepay fields do not apply to loop in, but were part of
the shared contract struct. Without also adding a migration, it wouldn't
be possible to keep the shared code.

In general it is probably more flexible to keep the contract
serialization code separated between in and out swaps.
5 years ago
Joost Jager 9a1b60b4be
multi: always supply chain params when decoding addresses 5 years ago
Olaoluwa Osuntokun 94f347e673
multi: finalize rename from uncharge to loop out 5 years ago
Olaoluwa Osuntokun 908d82acdb
loop: extract code from client package into new loop primary package 5 years ago