Commit Graph

223 Commits (master)

Author SHA1 Message Date
Oliver Gugger a7fff0ac2f
multi: update lnd master with grpc-gateway upgrade
To make loop work with the latest lnd version inside of LiT, we need
to upgrade the grpc-gateway library to the same v2 version here too.
3 years ago
Oliver Gugger 7091b90e95
Merge pull request #404 from guggero/fix-alpn-error
loopd: fix ALPN issue with Python
3 years ago
Oliver Gugger 803773bb65
loop+loopd: fix linter after re-generating protos
Apparently re-generating the protos caused the linter to pick up on
fields that are now deprecated. We need to fix that with a few comments.
3 years ago
Oliver Gugger 4e45c2908a
loopd: fix ALPN issue with Python
There is an open issue for Python gRPC clients that is
currently being debugged grpc/grpc#23172

It can be mitigated server-side by specifying h2 in the metadata header.
3 years ago
Oliver Gugger 45dbd582d1
multi: bump lnd min version to v0.11.1-beta
The version v0.10.1-beta of lnd is quite old with v0.13.0-beta just
being published as RC2. Maintaining backward compatibility in the
lndclient library is quite an effort. We decided to merge the v0.11.1
branch into master meaning that all our projects now have this minimum
version requirement.
3 years ago
Oliver Gugger 32f1f2657b
multi: bump lnd to version v0.13.0-beta.rc2
This commit bumps the _compile time_ version of lnd to v0.13.0-beta.rc2.
This does not have an effect on the user, the run time backward compatibility
will be preserved. Only the next commit will bump that minimum version.
3 years ago
Oliver Gugger 27fd6b3304
multi: use aperture instead of local lsat library
Since the lsat code was copied over to aperture a while ago for other
projects to use as well, we should migrate over to that shared code
also. This will give us the recently added "remove token if payment
failed and try again" feature for free along with some other small
updates to the lsat package.
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
Elle Mouton 65fe06cec2 loopd: verify loop out amount
This commit adds validation that checks if the loop out amount specified can
be satisfied given the nodes current channel balances.
3 years ago
Carla Kirk-Cohen d6db6184f3
Merge pull request #348 from yyforyongyu/344-loop-quote
looprpc: add verbose resp in loop quote
3 years ago
Carla Kirk-Cohen 4d9d398b23
Merge pull request #349 from ellemouton/validate-dest-addr-network
loopd: verify that dest addr is for correct chain
3 years ago
Elle Mouton 5399e60554 loopd: verify that dest addr is for correct chain
This commit adds verification to the loop out request to ensure that the
formatting of the specified destination address matches the network that
lnd is running on.
3 years ago
Elle Mouton 5c34dd1177 loopd: refactor loop out request validation
This commit moves loop out request validation for labels and
confirmation targets into its own function for the purpose of easy
testing and also to make the additions of future request validation easy
to add and test.
3 years ago
yyforyongyu c4d46a24a0
looprpc: add conf_target to loop in/out quote resp 3 years ago
carla 90561f8ac7
multi: add fee percentage to rpc 3 years ago
carla dd1a2de731
multi: add flat fee percentage to autoloop 3 years ago
carla c778124718
liquidity: move fees behind interface 3 years ago
Carla Kirk-Cohen fd4214e68d
Merge pull request #333 from carlaKC/autoloop-3-peerrules
autoloop: add peer level rules for aggregate liquidity management
3 years ago
carla b9aae4f8f9
loop: add peer rules to set rule command 3 years ago
carla 949e76bb2a
looprpc: add peer level rules to rpc 3 years ago
Andras Banki-Horvath 591a244867
loop: add sane default for --lnd.macaroonpath 3 years ago
carla 22bd4cabb4
looprpc: add disqualified channels to suggest swaps response 3 years ago
carla 7c4d71b175
liquidity: add reasons for autoloops not executing 3 years ago
carla 7ba1821696
liquidity: fail suggest swaps when no rules are set
In an effort to surface more information about why autoloop is not
executing, we add an error when suggest swaps is called with no rules.
In other cases we can surface a reason enum with each rule that is set,
but in the case where we have no rules, there are no results to
accompany with reasons.
3 years ago
Oliver Gugger 2a089d131e
loopd: all only specifying one lnd macaroon
Fixes #299 by allowing only one macaroon to be specified in the
--lnd.macaroonpath config option/command line flag.
3 years ago
carla 476ae39ce9
multi: make server side restrictions function generic 3 years ago
carla 24aa429aa0
liquidity: rename ticker and default to autoloop 3 years ago
carla 71ace95ac8
loop: rename autoloop specific parameters 3 years ago
carla a168ba3400
liquidity: rename auto out boolean to autoloop 3 years ago
Carla Kirk-Cohen d85cc010b0
Merge pull request #327 from carlaKC/325-waitunlocked
loopd: wait for lnd to be unlocked on startup
3 years ago
carla 3818e4576e
loopd: wait for lnd to be unlocked before starting 3 years ago
carla 6c2d88b3a5
multi: bump lndclient to version with wait for unlock 3 years ago
Oliver Gugger 1a57e03df4
loopd: pass macaroon root key ID in context 3 years ago
Oliver Gugger fb9034220c
mod: update lnd to v0.12.0 3 years ago
carla 74f2c96810
looprpc: add custom client sizes for autoloop 3 years ago
carla 3f0fc14c34
liquidity: allow custom autoloop swap sizes within the server's limits 3 years ago
Oliver Gugger 8758d00862
loopd: add initiator to swap requests 4 years ago
carla 87b02b7715
multi: add force tick endpoint behind debug server
To itest our autolooper, we need to be able to trigger dispatch on
demand. This functionality is included in a separate rpc server behind
a dev flag. Since it is unlikely that we need to split loop into
multiple rpc servers, this commit simply adds an additional debug server
rather than opting for a full subserver setup.
4 years ago
carla eb6b476469
looprpc: add autoloop parameters to rpc server 4 years ago
carla 8166d936e1
multi: add opt-in automated swap dispatch to liquidity manager 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
carla f23a527927
looprpc: add fee and backoff parameters to rpc 4 years ago
carla 0212a41ed0
liquidity: make swap suggestions fee-aware 4 years ago
carla 1d8609bae3
liquidity: add sweep fee limit and confirmations to suggestions
To decide whether we event want to attempt a swap, we add a fee limit
that we check against our estimate for the current number of
confirmations we want our sweep to confirm in. If fees are higher than
this limit, we do not suggest swaps.
4 years ago
carla 7740231bac
liquidity: make swap suggestions aware of ongoing swaps 4 years ago
carla ad8b5d0552
liquidity: add clock for mocking time in tests 4 years ago
carla 7e9034b2ff
liquidity: return OutRequest from swap suggestions and set fees
This commit updates swap suggestions to return loop out requests with
sufficient fields populated so that a loop out can directly be
dispatched from a suggestion. This requires setting of fees an min
sweep conf targets (our htlc conf target and addresss will be set by
the daemon's client rpc server if we do not provide them). We also do
some test refactoring so that we can more easily test the suggest swaps
endpoint.
4 years ago
carla ad2b37e709
loopd: add suggestions endpoints to macaroons 4 years ago
Oliver Gugger 688659421b
mod+loopd: bump to lnd v0.11.1-beta.rc3
To make sure we can use the latest version of loop in LiT, we need to
make sure loop compiles against the actual v0.11.1 branch of lnd. There
were some conflicting changes to the macaroon service that didn't make
it to the branch that we need to roll back. Those changes don't affect
loop at all as we were always using the default root key ID anyway.
4 years ago
Oliver Gugger 8c5bcf7c50
config: expand macaroonpath flag 4 years ago
Oliver Gugger 617964e25f
loopd: allow loopd to be used as external subserver
When loopd runs in the same process as lnd (in LiT), it hooks itself
into lnd's RPC server as an external subserver. But because the user
should still be able to use the default loop macaroon, the loop daemon
must be able to validate its own macaroons as lnd's macaroon service
doesn't know the root key for it.
4 years ago
Oliver Gugger 751c70e6c7
loopd: add macaroon authentication to the daemon's server connection
To secure access to loop's RPC server, we add a macaroon authentication
service and its gRPC interceptors to the daemon's server connection.
4 years ago
Oliver Gugger ff17553f3b
mod+loopd: update to lnd 0.11.1
We update to the newest version of lnd so we can use the updated
macaroon service.
NOTE: This is a compile time dependency update only, no RPC level update
is required.
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
Oliver Gugger a8d93bec6a
loopd: add TLS to the daemon's server connection 4 years ago
Oliver Gugger 17e0165d4c
loopd: add TLS config to listenerCfg struct
As a preparation to be able to listen on a TLS enabled listener, we add
a TLS config parameter to the listener setup functions.
4 years ago
carla 6b93c70b8a
looprpc: add swap suggestions endpoint 4 years ago
carla 340766fbb5
liquidity: add swap suggestions endpoint to manager 4 years ago
carla 6fcbf54c02
looprpc: add get and set liquidity parameters endpoints 4 years ago
carla ce10cc7959
liquidity: add manager with updatable parameters 4 years ago
Andras Banki-Horvath 9fdd531130
swap: add HTLC script version 4 years ago
carla ed04120a1a
loopd: set network in default config path 4 years ago
carla d229a1a607
config: add default network value 4 years ago
Carla Kirk-Cohen 048a365e02
Merge pull request #267 from carlaKC/215-readyonstart
loopd: wait for lnd to be synced before starting
4 years ago
carla b4e4d5c73d
loopd: block until lnd is synced to chain 4 years ago
carla d7150d5556
loopd: add data, loop and config options 4 years ago
carla 852f459391
multi: add htlc confirmations parameter to client loop out request 4 years ago
carla 8da0ea6048
looprpc: add label to swap creation and display in list swaps 4 years ago
carla a9849bb317
multi: add failure reason to swap client server
To provide more information about swaps, we add a failure reason field
to our swaps. We do not extend our existing state enum to remain
backwards compatible.
4 years ago
Joost Jager 43323ffbe2
loopout: extend htlc expiry based on conf target 4 years ago
Joost Jager e72d998e78
loopout: show expiry range in terms 4 years ago
Joost Jager 8d1ec50fa7
looprpc: split quote message 4 years ago
Joost Jager 24099aa4f9
looprpc: split terms message 4 years ago
Joost Jager 1869ad670f
looprpc: expose server message to clients 4 years ago
Joost Jager 68012f051a
loopout: create LoopOutSwapInfo struct 4 years ago
Joost Jager 0c9fcd790e
lndclient: move to github.com/lightninglabs/lndclient 4 years ago
Joost Jager 83f25c98a3
loopd: return missing p2wsh loop out address 4 years ago
Joost Jager b61b886c16
loopd: group and clarify swap server parameters 4 years ago
Oliver Gugger c2e513ecd0
loopd: remove short flags to avoid collision 4 years ago
Oliver Gugger 74b3580e01
loopd+cmd/loopd: rename main Start function to Run 4 years ago
Oliver Gugger 774a44fac1
loopd: add StartAsSubserver method and started flag 4 years ago
Oliver Gugger 506d0c2257
loopd: refactor into Start/Stop methods 4 years ago
Oliver Gugger 215e5b99d6
loopd: extract daemon into struct 4 years ago
Oliver Gugger e696a38ec8
loopd: export Config struct 4 years ago
Oliver Gugger 5f70a05463
loopd: export DefaultConfig 4 years ago
Joost Jager ccec719423
looprpc: add outgoing channel set restriction
Expose the new channel set restriction on the loopd client rpc.
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 c62acd5b85
lndclient: add outgoing channel set restriction
Expose the channel set restriction that was introduced in LND 0.10.1 on
the proxy object.
4 years ago
Andras Banki-Horvath 936bb851f2 loopin: fix htlc address in LoopIn SwapResponse 4 years ago
Joost Jager 27a2b1a775
loopd: fix setting of max parts 4 years ago
Andras Banki-Horvath 0aa978bd09 loopin: modify internally published htlc to use p2wsh 4 years ago
Andras Banki-Horvath f0aff9b7bd looprpc+loopin: support for native segwit htlcs
This commit extends SwapResponse and SwapStatus with np2wsh and p2wsh
htlc output addresses to support both nested and native segwit htlcs
in loop-in.

Furthermore the commit adds support for native segwith loop-in htlcs.
When the htlc is paid internally, as of this commit we'll use NP2WSH,
otherwise users are free to select whether to pay the NP2WSH or the
P2WSH htlc.
4 years ago
Andras Banki-Horvath 62f654eef1 client: make ListSwaps thread safe 4 years ago
Andras Banki-Horvath 7a44eec36f loopin: refactor LoopIn to return struct instead of tuple 4 years ago
Joost Jager 12ae3d6a40
loopd: make maximum number of payment parts configurable 4 years ago
Joost Jager 5588876b48
loopd: extract client configuration 4 years ago
Oliver Gugger ad4e1e971e
loopd: check lnd version and subservers 4 years ago
Oliver Gugger a8e6118cfb
loopd+lndclient: extract config parameters into struct 4 years ago
carla fc99c8b320
multi: add confirmation target to loop in 4 years ago
carla f726fc2bc8
loopd: add missing zero case to validateConfTarget
Update validate function to return default target for zero value
confirmation targets, as indicated by the comment. This change
introduces a behaviour change for direct rpc calls to loopd (ie,
those not made by the loop cli tool). Previously, these calls
would fail and indicate that the conf target must be > 2, now
they will succeed with the default conf target. The loop cli
tool is unaffected because we already set the default value.

When clients upgrade from a previous version of loopd which did
not have this check, preexisting loops will be unaffected, because
loop ins had the default of 6 confirmations set, and loop outs with
<2 conf target would not have been created.
4 years ago
carla 1f5aeff45f
multi: unify default sweep/htlc conf targets
Create a HtlcConfTarget which is used as a default for quote
and loop in. Update loop out quote to use the existing var
rather than just 6 inline.
4 years ago
Andras Banki-Horvath f4be20cc5e loopd: add missing mutex unlock and fix subtle reace condition 4 years ago
Wilmer Paulino 5b732d9012
loopd: add SOCKS proxy config option to dial swap server over Tor
This allows Loop users to further improve their privacy by not revealing
their source IP address. Note that the identity of the lnd node behind
Loop can still be revealed when performing a Loop In due to the swap
server extending an off-chain HTLC to the user.

Onion addresses don't yet exist for the swap servers, but they will be
added at a later time.
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
Oliver Gugger ae376a49ba
loopd: fix linter issue 4 years ago
Oliver Gugger 8c7eee2ba9
loopd: add option to configure CORS origin 4 years ago
Oliver Gugger b694a76be0
looprpc+loopd: deprecate string ID 4 years ago
Oliver Gugger 26c0c17dbd
loopd+cli: set max gRPC message receive size 4 years ago
Oliver Gugger e070494565
loopd: instruct REST proxy to print default values 4 years ago
Oliver Gugger 3e25bc3174
loopd+looprpc: add REST compatible status calls 4 years ago
Oliver Gugger 403b4097de
loopd: move global state into server state 4 years ago
Oliver Gugger 098e269fe6
loopd: add LSAT enabled server ports 4 years ago
Oliver Gugger ccdbc3b21b
multi: thread new config values through client 4 years ago
Oliver Gugger 8aeeaefbaf
loopd+lsat: add LSAT cost configuration parameters 4 years ago
Johan T. Halseth b2d1d99521
loopd call swapserver with SwapPublicationDeadline set 4 years ago
Johan T. Halseth 0a51bf4d2d
loopd: make lnd conn configurable 4 years ago
Johan T. Halseth 34c2e71f9e
loopd: move lnd services init to config
This allows us to supply custom lnd connections to the daemon.
4 years ago
Johan T. Halseth c7e8c9f964
loopd: make RPC listener configurable
Allows to use external listener, such as in-memory.
4 years ago
Johan T. Halseth 0f0573c047
loopd/daemon: make server gRPC/REST listeners configurable 4 years ago
Johan T. Halseth 391ae9dc6b
loopd/daemon: handle proxy error
Check returned error to make linter happy.
4 years ago
Johan T. Halseth 2334816a59
lndclient: split NewLndServices to take gRPC dialer 4 years ago
Johan T. Halseth 704bfff8f6
cmd+loopd: new cmd/loopd main method replacing the one now in ./loopd
This allows loopd to be used as a library by importing it and calling
Start.
4 years ago
Johan T. Halseth 644b5b16f7
cmd+loopd: move loopd to new folder loopd 4 years ago