2
0
mirror of https://github.com/lightninglabs/loop synced 2024-11-09 19:10:47 +00:00
Commit Graph

103 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
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
cc5e26b9c9
proto: extend protocol with key reveal building blocks and new version
This commit adds a new protocol version which will add MuSig2 loop in
and loop out using key reveal and extends the existing protocol with new
message members to be able to pass around htlc internal public keys.

The commit also fixes some minor formatting issues in the server proto.
2023-03-20 20:08:42 +01:00
George Tsagkarelis
7c6abc0d67
loopdb: add tests for new store methods 2023-03-09 00:43:06 +02:00
George Tsagkarelis
4f20239dbb
loopdb: extend store methods for fetching single swap 2023-03-09 00:43:06 +02: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
a252e2c706
loopdb: add the local pubkey's keylocator to the persisted contract 2022-06-30 16:59:57 +02:00
Andras Banki-Horvath
00cf4bf71c
multi: make the next protocol version optional 2022-06-30 16:59:54 +02:00
Andras Banki-Horvath
9b37d744a0
multi: add ProtocolVersion_HTLC_V3 2022-06-30 16:59:54 +02:00
yyforyongyu
26edd21889
loopdb: add new bucket to save liquidity params
This commit adds a new bucket to save liquidity parameters. We've
skipped the serialization and deserialization implementations here and
leave them to be handled by the liquidity package.
2022-06-07 19:19:53 +08:00
sputn1ck
a1271fee40
multi: fix linter issues 2022-05-20 10:16:46 +02:00
Harsha Goli
7a16e3b25d
multi: bump btcec/v2 and btcutil to new versions 2022-03-25 11:00:16 +01:00
Andras Banki-Horvath
0f002733f6
loop: extend server protocol for routing plugin recommendations
This commits extends the server protocol with routing plugin
recommendations and routing result reporting.
2022-02-14 10:14:42 +01:00
carla
167cef4f6b
loopdb: alias swapserverrpc with looprpc
Packages importing loop can't import this package without aliasing
the import.
2021-12-13 15:23:36 +02:00
carla
dad103530f
multi: move server proto files to their own directory
Protobuf does not allow naming conflicts for files within the same
process, because all proto messages register themselves in a global
registry.

This is problematic because the server's itests import the client's
looprpc package to make rpc queries to the loopd client, thus importing
duplicate common.proto and server.proto from the client's looprc package
(since they're both in there as well).

This change moves the server's proto files into their own directory so
that they are not imported when we want to use the client's files. We
cannot change the package name for the server, because that would be
a breaking change (the package name is included in URIS). Fortunately,
we have the go_package option which allows us to place generated files
in a different location.
2021-12-13 13:56:40 +02:00
carla
26886731d4
multi: remove shadowed label variable in loopin swaps
We already have a Label field in the embedded SwapContract
field for loop in swaps. This commit removes an erroneously
added Label field in LoopInContract which may be a cause of
ambiguity when referencing this field.
2021-12-09 13:40:34 +02:00
Andras Banki-Horvath
f786aaa016
loop: add support for the probe API 2021-07-30 13:22:12 +02:00
carla
71501ef2e8
looprpc: add server cancelation rpc to server.proto 2021-05-24 08:40:12 +02:00
Oliver Gugger
39c8c9278d
loopd+loopdb: add timeout to DB open
To make sure we don't just block for forever if another Loop daemon
process is already running, we add a timeout and error out if obtaining
the unique file lock fails after 5 seconds.
2021-04-28 17:16:27 +02:00
carla
692620d367
liquidity: add fee budget to swap suggestions
Add a dated fee budget to our swap suggestions. This budget only applies
to automatically dispatched swaps (which will be added in later
commits). We choose to apply the fee budget to our suggestions so that
they perfectly replicate what the autolooper would do. The budget has a
start date so that it can be refreshed once it has been used up over a
period (rather than having to endlessly increase it).
2020-10-12 13:34:54 +02:00
carla
7b56804bbe
multi: move label validation to rpc and simplify validation function
Previously labels with reserved prefixes were added to provide us
with a way to identify automatically dispatched loops. This commit moves
the validation of these labels to the rpc level so that it will only
apply to user-initiated swaps.
2020-10-12 13:34:52 +02:00
Joost Jager
c8666caf20
loopin: mpp pre-swap probe 2020-09-17 13:24:54 +02:00
Andras Banki-Horvath
133f3cac5f multi: integrate the new htlc v2 scripts to loop in/out
This commit bumps the current protocol version and integrates htlc v2
with loop in/out for new swaps, while keeping htlc v1 for any pending
swaps with previous protocol versions.
2020-09-09 19:54:01 +02:00
Andras Banki-Horvath
86db43a2cb loopdb: store protocol version alongside with swaps
This commit adds the protocol version to each stored swap. This will be
used to ensure that when swaps are resumed after a restart, they're
correctly handled given any breaking protocol changes.
2020-09-09 19:54:01 +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
carla
9678c7817d
multi: add swap label to SwapContract and store under separate key
This commits adds an optional label to our swaps, and writes it to
disk under a separate key in our swap bucket. This approach is chosen
rather than an on-the-fly addition to our existing swap contract field
so that we do not need to deal with EOF checking in the future. To allow
creation of unique internal labels, we add a reserved prefix which can
be used by the daemon to set labels that are distinct from client set
ones.
2020-08-03 10:55:58 +02:00
Joost Jager
a3b7fa5977
loopin: fail swap when htlc amount is incorrect
Previously the swap would get stuck in a state where it wouldn't ever
progress because the server rejected the htlc.
2020-06-25 14:22:46 +02:00
Joost Jager
b5a49ed205
loopdb: classify InvoiceSettled as pending 2020-06-25 12:39:07 +02:00
Joost Jager
4da4738a2d
loopdb: persist htlc tx hash 2020-06-24 15:28:09 +02:00
Joost Jager
12a7b34d88
loopdb: migrate to nested updates structure 2020-06-24 15:28:07 +02:00
Joost Jager
eaf8239e49
loopdb: allow restored databases to contain nil values 2020-06-23 12:46:00 +02:00
Joost Jager
3e71ff0c81
loopdb: strongly typed constants 2020-06-23 12:45:58 +02:00
Joost Jager
8c544bf2ba
loopdb: store outgoing channel set
Upgrade the database schema to allow for multiple outgoing channels.
This is implemented as an on-the-fly migration leaving the old key in
place.
2020-05-21 11:22:04 +02:00
Joost Jager
044c1c12dd
loopdb/test: add database dump and restore tools 2020-05-21 11:22:02 +02:00
Joost Jager
bd6e3f405a
loopdb/test: parameterize loop out test 2020-05-21 11:22:00 +02:00
Joost Jager
503c83c29f
loopdb: unroll shared fetch logic
Split the fetch logic so that it is easier to add loop type-specific
serialization.
2020-05-21 11:21:56 +02:00
Joost Jager
9927139dd3
loopdb: extract update deserialization
Preparation to prevent code duplication in future refactoring.
2020-05-21 11:13:52 +02:00
Joost Jager
ba5577748b
loopdb: unroll shared creation logic
Another step in the separation of loop in and loop out. This prepares
for a new loop out-specific key to be added.
2020-05-21 11:13:50 +02:00
Joost Jager
535e964ec9
loopdb: migrate loop in channel to last hop
A database field was already in place to allow channel selection for
loop in. Unfortunately this field, which contains a short channel id,
isn't easily usable for controlling the loop server payment. Because of
non-strict forwarding, it is only possible to constrain a route to a
specific last hop pubkey.

This commit converts the existing field into a pubkey field.
2020-02-17 19:59:05 +01:00
Johan T. Halseth
034cba5b95
loopdb/loopout: add field SwapPublicationDeadline to LoopOutContract
We also add a migration for the new LoopOut DB format.
2019-11-21 18:47:00 +01:00
Oliver Gugger
b574e344ea
multi: add persistent logger 2019-10-28 17:09:23 +01:00
Oliver Gugger
36838cf7f4
multi: fix most obvious linter errors 2019-10-09 14:35:41 +02:00
Joost Jager
6efa62347b
multi: store swap cost in database 2019-05-20 13:57:18 +02:00
Joost Jager
24a1b8d642
loopdb: initialize new database with current version 2019-05-20 13:57:15 +02:00
Joost Jager
7d6ed06d5c
loopdb: enable logging
Previous code in log.go assumed there would by sub system level
enable/disable for loop. This is not yet in place, so converting to same
style as used in the lndclient package.
2019-05-20 13:57:12 +02: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
b5d2fb3894
loopd: add loop in state InvoiceSettled 2019-04-02 10:54:40 +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
e81298ce3e
loopdb: move code to shared code file 2019-03-28 11:28:03 +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
cdcb9f8345 loopdb: make new loopdb package to house persistent storage 2019-03-06 20:33:27 -08:00