2
0
mirror of https://github.com/lightninglabs/loop synced 2024-11-04 06:00:21 +00:00
Commit Graph

34 Commits

Author SHA1 Message Date
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.
2023-04-25 17:26:01 +02:00
Andras Banki-Horvath
4d34eb97ce
build: fixup new linter issues 2023-03-29 15:56:40 +02:00
Andras Banki-Horvath
cd91f90ed2
loop: use MuSig2 1.0 scheme for the new MuSig2 swaps 2023-03-20 20:08:43 +01:00
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.
2023-03-20 20:08:43 +01:00
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.
2023-02-06 20:46:03 +01:00
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.
2022-12-15 18:08:38 +01:00
Andras Banki-Horvath
049b17ff96
misc: refactor loop tests to use require where possible 2022-11-30 18:16:45 +01:00
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.
2022-11-30 18:16:44 +01:00
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.
2022-11-04 17:14:53 +01:00
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.
2022-06-30 16:59:59 +02:00
Andras Banki-Horvath
391ef57ea3
loopout: enable p2tr without keyspend 2022-06-30 16:59:55 +02:00
Andras Banki-Horvath
152677fcc7
test: fix naming in client tests 2022-06-30 16:59:55 +02:00
Andras Banki-Horvath
9610becebd
multi: add the aggregate internal pubkey to the v3 htlc 2022-06-09 10:20:16 +02:00
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.
2022-04-22 11:36:09 -04:00
Harsha Goli
7a16e3b25d
multi: bump btcec/v2 and btcutil to new versions 2022-03-25 11:00:16 +01:00
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.
2021-07-19 10:28:34 +02:00
carla
f166ce899d
loopout: cancel swap with server when off-chain fails 2021-05-24 08:46:03 +02:00
Oliver Gugger
2a732a4385
loop: add initiator string to user agent 2020-11-06 10:43:03 +01:00
Andras Banki-Horvath
98bdbcddfb tests: extend tests to also test resuming with HTLC v2 2020-09-09 19:54:01 +02:00
carla
852f459391
multi: add htlc confirmations parameter to client loop out request 2020-08-04 20:29:09 +02:00
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.
2020-08-04 20:28:06 +02:00
Joost Jager
68012f051a
loopout: create LoopOutSwapInfo struct 2020-06-30 16:59:06 +02:00
Joost Jager
e22524a262
loopout: register for confirmation using htlc tx hash 2020-06-24 15:28:12 +02:00
Joost Jager
190caa4097
loopout/test: refactor test 2020-06-24 15:28:10 +02:00
Joost Jager
0c9fcd790e
lndclient: move to github.com/lightninglabs/lndclient 2020-06-18 14:27:52 +02:00
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.
2020-06-08 12:54:08 +02:00
Oliver Gugger
bf6f6b31f4
client: fix some comments 2020-04-22 13:52:05 +02:00
Joost Jager
a05e46697d
test: assert raw output signing requests 2020-01-15 16:42:49 +01:00
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.
2019-05-20 13:57:09 +02:00
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.
2019-04-02 00:02:04 +02:00
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.
2019-03-28 11:47:38 +01:00
Joost Jager
9a1b60b4be
multi: always supply chain params when decoding addresses 2019-03-26 17:25:51 +01:00
Olaoluwa Osuntokun
94f347e673
multi: finalize rename from uncharge to loop out 2019-03-06 20:34:04 -08:00
Olaoluwa Osuntokun
908d82acdb
loop: extract code from client package into new loop primary package 2019-03-06 20:34:01 -08:00