Commit Graph

36 Commits (803773bb65a5bae560151896a86bcc161c47ca9d)

Author SHA1 Message Date
carla 71501ef2e8
looprpc: add server cancelation rpc to server.proto 3 years ago
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.
3 years ago
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).
4 years ago
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.
4 years ago
Joost Jager c8666caf20
loopin: mpp pre-swap probe 4 years ago
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.
4 years ago
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.
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
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.
4 years ago
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.
4 years ago
Joost Jager b5a49ed205
loopdb: classify InvoiceSettled as pending 4 years ago
Joost Jager 4da4738a2d
loopdb: persist htlc tx hash 4 years ago
Joost Jager 12a7b34d88
loopdb: migrate to nested updates structure 4 years ago
Joost Jager eaf8239e49
loopdb: allow restored databases to contain nil values 4 years ago
Joost Jager 3e71ff0c81
loopdb: strongly typed constants 4 years ago
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.
4 years ago
Joost Jager 044c1c12dd
loopdb/test: add database dump and restore tools 4 years ago
Joost Jager bd6e3f405a
loopdb/test: parameterize loop out test 4 years ago
Joost Jager 503c83c29f
loopdb: unroll shared fetch logic
Split the fetch logic so that it is easier to add loop type-specific
serialization.
4 years ago
Joost Jager 9927139dd3
loopdb: extract update deserialization
Preparation to prevent code duplication in future refactoring.
4 years ago
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.
4 years ago
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.
4 years ago
Johan T. Halseth 034cba5b95
loopdb/loopout: add field SwapPublicationDeadline to LoopOutContract
We also add a migration for the new LoopOut DB format.
4 years ago
Oliver Gugger b574e344ea
multi: add persistent logger 5 years ago
Oliver Gugger 36838cf7f4
multi: fix most obvious linter errors 5 years ago
Joost Jager 6efa62347b
multi: store swap cost in database 5 years ago
Joost Jager 24a1b8d642
loopdb: initialize new database with current version 5 years ago
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.
5 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 b5d2fb3894
loopd: add loop in state InvoiceSettled 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 e81298ce3e
loopdb: move code to shared code file 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 cdcb9f8345 loopdb: make new loopdb package to house persistent storage 5 years ago