Commit Graph

223 Commits (master)

Author SHA1 Message Date
Andras Banki-Horvath b36885fb65
loopd: correct htlc output type on view command
Previously view may have set the output type wrongly for internal p2wsh
and p2tr loop-in swaps which is corrected in this commit.
1 year ago
Andras Banki-Horvath 977b72019d
loopd: bump minimum lnd version to v0.15.1-beta
In this commit we bump the minimum LND version required to run loopd to
v0.15.1-beta in order to ensure that the underlying chain backend
supports taproot (https://github.com/lightningnetwork/lnd/pull/6798)
2 years ago
sputn1ck 0f924b36cd
multi: bump lndclient and lnd version to latest
Co-authored-by: Oliver Gugger <gugger@gmail.com>
2 years ago
András Bánki-Horváth 11ab596080
Merge pull request #497 from bhandras/taproot-musig2
multi: upgrade to using P2TR htlcs and added support for MuSig2 loopout sweep
2 years ago
Andras Banki-Horvath 85145ca4bb
loop: set minimum LND version to 0.15.0 2 years ago
Andras Banki-Horvath 391ef57ea3
loopout: enable p2tr without keyspend 2 years ago
Andras Banki-Horvath 901a935514
loopin: enable p2tr htlcs without keyspend 2 years ago
Andras Banki-Horvath 00cf4bf71c
multi: make the next protocol version optional 2 years ago
Elle Mouton 8ccd35e0c1
loopd: move RequiredPermissions to dedicated dir
This commit moves the RequiredPermissions map to its own directory so
that projects importing the permissions list dont need to import all the
dependencies of the loopd package.
2 years ago
András Bánki-Horváth 8f23c6789b
Merge pull request #477 from bhandras/taproot-htlc
multi: changes to the taproot HTLC  required for both client and server
2 years ago
Andras Banki-Horvath 9610becebd
multi: add the aggregate internal pubkey to the v3 htlc 2 years ago
sputn1ck 1df6685653
looprpc: fix suggestswaps response
This commit fixes the SuggestSwaps rpc call. Previously, when multiple
DisqualifiedPeers were provided, all pubkeys would be the same.
2 years ago
yyforyongyu 425a007aaf
loopd+liquidity: persist parameters on disk
This commit saves the RPC request used to construct the `Parameters` on
disk. Since it's a proto message, an easy way to read/write it is to
rely on the proto marshal/unmarshal methods. A side effect is that
migration also becomes easy as proto message have its own internal
mechanism to keep track of the compatibility.
2 years ago
yyforyongyu 8217ee31c3
liquidity+loopd: refactor `SetParameters` to take a rpc request
This commit refactors the method `manager.SetParameters` to take a
`SetLiquidityParamsRequest`. As we'll see in the following commit, this
will enable us saving the params to disk more easily.
2 years ago
sputn1ck ece0f76e7f
loop: update listswaps api 2 years ago
Yong e98d813885
Merge pull request #495 from sputn1ck/check_p2pk_dest
loopout: reject P2PK addresses
2 years ago
sputn1ck ce596468e9
loopout: reject unsupported address formats
This commit adds a check to reject unsupported address
formats such as P2PK or P2TR addresses
2 years ago
sputn1ck a34f22c443
make fmt 2 years ago
sputn1ck a1271fee40
multi: fix linter issues 2 years ago
sputn1ck f0bf9302cc
make: dockerize linter 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
Andras Banki-Horvath 5b737855c1
loopd: update minimum required LND version to v0.14.2-beta 2 years ago
Andras Banki-Horvath 1d1354d2cb
config: make total payment timeout and retries configurable 2 years ago
Elle Mouton 2d7745ecf4 loopd/daemon: rename createDefaultMacaroonFile
Rename createDefaultMacaroonFile to withMacaroonService since this is
now a more appropriate name.
2 years ago
Elle Mouton ad7cdc8ed2 multi: use lndclient MacaroonService
Since the code for creating and using a macaroon service is the same for
multiple projects (pool, loop, litd etc), the code has been unified in
lndclient. So this commit removes the macaroon service code and instead
uses the lndclient code.
2 years ago
Andras Banki-Horvath b3d8f5f096
loopd: close dbs when the daemon stops 2 years ago
carla 16799838f7
multi: surface loop in parameters on rpc 2 years ago
carla 4689040333
multi: surface suggested loop in swap on rpc 2 years ago
carla 5280721636
multi: add ability to autoloop in 2 years ago
carla 5e47a0c6e9
multi: add loop in swap builder implementation 2 years ago
carla 213f5c7c8b
loopd: alias server rpc import with looprpc
Packages importing loopd can't import 2x looprpc packages (in the
form of swapserverrpc and looprpc). To get around this, we alias
each import with a different name, updating the server in this
commit.
2 years ago
carla 996b5e43ab
loopd: alias client rpc import with clientrpc
Packages importing loopd can't import 2x looprpc packages (in the
form of swapserverrpc and looprpc). To get around this, we alias
each import with a different name, starting with the client in this
commit.
2 years ago
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.
2 years ago
Harsha Goli 52087c8bb4
Merge pull request #434 from arshbot/default-macaroon-locations
loopd: Consider network when making LND paths
2 years ago
Harsha Goli 3fb75131ea
loopd: Consider network when making LND paths
In this commit we consider the passed network options when assuming the
LND macaroon path if not passed by user
2 years ago
Harsha Goli f1a7d8fb49
multi: pass private, routehints from loopcli - loopd - loop server
This commit passes routehints all the way from when/if the user passes
them from the cli all the way to the backend loop server. If private is
used, this commit passes that boolean down to different stages, where it
is then converted into routehints.

main: add --private and --route_hints to quote

Adds --private and --route_hints flags to quote cli
2 years ago
carla 91a90968d0
multi: surface swap type on rpc 2 years ago
carla 25b8d20f75
liquidity: add type to rules
In preparation for adding loop in swaps, we relate liquidity rules
to a specific type of swap that we want to dispatch. This allows us
to use a single rule format for multiple swap types.
2 years ago
Carla Kirk-Cohen 04b4f0a389
Merge pull request #432 from carlaKC/export-listnerconfig
loopd: export NewListenerConfig
2 years ago
carla 618310fe6f
loopd: export NewListenerConfig 2 years ago
Turtle 1503001ee5
loopd: conditionally create default macaroon file
In some cases we don't want the default macaroon file to be created on
disk, so we allow passing in a boolean that toggles the macaroon
creation.
3 years ago
Oliver Gugger 2c6e035235
multi: bump lnd compile time dependency to v0.14.0-beta.rc1 3 years ago
carla cca5926263
multi: bump lndclient to v0.12.0-13
To allow code with more up-to-date dependencies to import loop, we
bump our lndclient version. The minimum loop version remains 11.1
since we're not using any new apis.
3 years ago
Martin Habovstiak 158e22f2a7 Documented the menaing of returned bool 3 years ago
Martin Habovstiak c00da1cf09 Renamed explicitConfig to hasExplicitConfig
`hasExplicitConfig` is considered cleaner.
3 years ago
Martin Habovštiak 2c1e437f26
Remove extra space
Co-authored-by: Yong <yy2452@columbia.edu>
3 years ago
Martin Habovstiak 84582bbb88 Improve error handling of config file
This makes two changes to handling of errors when configuration file
could not be loaded:

1. Only NotFound errors are considered OK - access errors and other FS
   issues are now treated as fatal.
2. Failing to load config file specified explicitly via `--configfile`
   option is alway a fatal error.

Rationale: If the configfile was specified explicitly then it indicates
the user really wishes to load it. While the user could want it to be
optionally loaded for extra configuration options, this can be
accomplished using an empty file.

If the config file was not specified explicitly then its' path was
computed from loop directory. If the file is inaccessible due to
permissions or other FS errors it's nearly certain other following
operations will fail as well. Failing early with a clear message is thus
beneficial.

This still leaves room for uncaught user error (e.g. mistakenly naming
config file inside loop dir as `loop.conf` instead of `loopd.conf`) but
it's greatly reduced and such error should be easier to identify.

(Indirectly) closes #412
3 years ago
Andras Banki-Horvath 0e7ed91d5d
loop: integrate the probe api with loop-in quote
In this commit we add a call to the new probe endpoint directly into the
loop-in quote call. Furthermore we add an option to include private
channels in the loopin swap payment request. This is also useful for when
users quote/probe directly using the client API and specify hop hints.
3 years ago
Andras Banki-Horvath f786aaa016
loop: add support for the probe API 3 years ago
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