Commit graph

58 commits

Author SHA1 Message Date
Oliver Gugger
f460060692
wasm 2021-05-25 14:21:39 +02:00
Oliver Gugger
327b6a703d
multi: bump lnd to version v0.13.0-beta.rc2 2021-05-19 14:28:53 +02:00
Olaoluwa Osuntokun
ba9a223bd6
sidecar: use a funciton closure for PrepareOrder
The RPC server won't be created by the time we attempt to reach for this
pointer, so we use a function closure to allow "lazy" evaluation which
only attempts to derf once the system is already up and running.
2021-05-09 19:25:16 -07:00
Olaoluwa Osuntokun
d0390b4c2c
server: add new config for sidecar acceptor 2021-05-09 19:25:02 -07:00
Oliver Gugger
482f4828b9
server+sidecar_acceptor: consume auction messages
Whenever we are expecting a sidecar channel with us as the recipient, we
subscribe to the auction server through the special new SubscribeSidecar
RPC that works exactly the same as the SubscribeBatchAuction with the
only difference that we can use our channel funding multisig key as the
authentication key instead of the trader account key.
We have to react to all batch auction messages but our role is somewhat
simplified as we don't have to fully verify or sign the batch itself.
2021-04-06 13:36:31 +02:00
Oliver Gugger
36b30a741d
multi: add auctioneer client to sidecar acceptor 2021-04-06 13:36:31 +02:00
Oliver Gugger
bc9bf56a8d
server+funding: add sidecar offer to funding manager
With this commit we add the business logic for creating a sidecar
channel offer as the provider.
We choose the funding manager as the place for this logic as that
already has most of the required lnd clients and will ultimately be
responsible for kickstarting the funding of the sidecar channel on the
provider's side.
2021-04-06 13:36:30 +02:00
Oliver Gugger
27ed02a5c4
multi: add sidecar acceptor type
With this commit we add a new sidecar acceptor type that is exclusively
responsible for managing the recipient's tasks of executing a sidecar
channel. The two tasks are:
1. Verify a sidecar ticket and the offer contained within then add the
   recipient node information to the ticket so it can be returned to the
   sidecar provider. This is step 2/4 of the entire sidecar execution
   protocol.
2. Interact with the auction server and connect out to an asker's node in the
   right moment then accept the incoming channel. This is step 4/4 of the
   entire sidecar execution protocol.
The code for these two tasks are kept separate from the default funding
manager to make it easier to extract a standalone sidecar acceptor
client later on. It also makes it easier to see what code would need to be
re-implemented in another language to integrate just the acceptor part.
2021-04-06 13:36:30 +02:00
Oliver Gugger
2730d69c2f
funding+server: turn pending chan sub into subscription server
As a preparation for allowing multiple managers to consume the pending
channel updates, we move those events from a single channel to a
subscribe.Server construct.
We also pass in the subscription client to use into waitForChannelOpen
so we can use a different one in different flows.
2021-04-02 15:27:35 +02:00
Oliver Gugger
6923729566
funding+server+rpcserver: use funding.ManagerConfig
As a preparation to add non-exported fields to the funding manager, we
want to create a NewManager function that takes a config instead of
instantiating the manager directly.
2021-04-02 14:18:12 +02:00
Oliver Gugger
5a95222b7c
multi: add channel acceptor
With everything else in place, we now only need to add and start a
channel acceptor that looks at each incoming channel and rejects it if
the push amount offered doesn't match the value in the bid order.
2021-03-19 16:50:33 +01:00
Oliver Gugger
4d6fdae004
funding+order: move DefaultBatchStepTimeout
We need to use the DefaultBatchStepTimeout variable outside of the
funding manager as well and move it to the order package to not create a
circular dependency when accessing it from the root package.
2021-03-19 16:50:32 +01:00
Oliver Gugger
0cf137c511
server: fix nil pointer panic when running as subserver
When Pool is started as a subserver in LiT the gRPC server is never
initialized. When trying to stop Pool this would lead to a nil pointer
panic.
2021-02-24 09:31:41 +01:00
kon
4537447933 auctioneer: add tor proxy 2021-02-04 09:58:57 +01:00
Oliver Gugger
7c1e8c9d53
multi: allow only specifying one lnd macaroon
Fixes #196 by allowing only one macaroon to be specified in the
--lnd.macaroonpath config option.
2021-02-02 09:57:21 +01:00
Oliver Gugger
f163ac85d8
server: emit default values in JSON
Fixes #208 by always rendering the default values in a JSON response,
even if they are "falsey" in the RPC message.
2021-02-02 09:57:05 +01:00
Oliver Gugger
e245576d70
auctioneer+server: send user agent to auctioneer
Send the static user agent plus the dynamic initiator string (if
provided) to the auctioneer in the InitAccount and SubmitOrder RPCs.
2021-01-29 12:56:23 +01:00
Oliver Gugger
646222d29b
server: block until lnd is unlocked 2021-01-15 22:15:01 +01:00
Oliver Gugger
22dcd1f7a1
multi: update lndclient and other deps 2021-01-15 22:14:36 +01:00
Oliver Gugger
671f430b88
multi: use funding manager as BatchCleaner
If we detect we have a pending batch in the local database that was
replaced by a different transaction, we try to clean up funding shims
and pending channels on startup as well.
To allow that, we use the funding manager as the BatchCleaner
implementation.
2020-12-09 09:42:31 +01:00
Oliver Gugger
5098fe1ccb
auctioneer+server: add new BatchCleaner interface
To prepare for using the funding manager to do the actual cleanup of a
pending batch, we extract the cleanup itself into a new interface.
2020-12-09 09:42:31 +01:00
Oliver Gugger
90b6e8c598
server: initialize funding manager in server
We'll soon need a reference to the funding manager in the server, so we
can pass it to the auctioneer client. To enable that, we initialize and
use it in the server instead of the rpcserver.
2020-12-09 09:42:30 +01:00
Oliver Gugger
9714deb848
multi: specify DB filename when opening clientdb
To make it possible to open any DB in the debug CLI, we allow specifying
the file name too instead of only the path.
2020-11-24 14:27:45 +01:00
Oliver Gugger
058307a18f
server: fix REST connection
Because of a misplaced defer of a context cancel, the REST proxy didn't
work at all before the fix in this commit.
2020-11-24 11:28:00 +01:00
Oliver Gugger
6f046b585f
server: remove incorrect additional TLS listener wrap
If the REST listener is not nil at this point, it is always already
wrapped in a TLS listener and doesn't need to be wrapped again.
2020-11-24 11:27:59 +01:00
Oliver Gugger
b9358dec8f
server: allow poold to be used as external subserver
When poold 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 llm macaroon, the pool daemon must be
able to validate its own macaroons as lnd's macaroon service doesn't
know the root key for it.
2020-09-17 08:37:22 +02:00
Oliver Gugger
1dc624a24a
config+server: add macaroon authentication to pool's server connn
To secure access to pool's RPC server, we add a macaroon authentication
service and its gRPC interceptors to the daemon's server connection.
2020-09-17 08:37:21 +02:00
Oliver Gugger
32e1006ef6
config+server: add TLS to pool's server connection 2020-09-12 09:08:13 +02:00
Oliver Gugger
ce235cbc1d
multi: extract config validation
As a preparation to add more configuration paths for TLS, we first
extract the config validation and path cleanup into its own function.
2020-09-12 09:08:13 +02:00
Oliver Gugger
123522e3b6
lnd+server+run: bump lnd to v0.11.1-beta
We update to the latest lnd version that contains the new flag in
AbandonChannel that we need. Because master is now tagged with
v0.x.99-beta, we can already increase the required version in the
server.
Because we touch this file anyway, let's as well avoid a bug in
lndclient that requires a subserver macaroon to be present even if we
don't need that subserver's functionality.
2020-09-10 13:47:17 +02:00
Olaoluwa Osuntokun
1e0035d3d4
multi: fix import order 2020-09-09 19:55:16 -07:00
Olaoluwa Osuntokun
ffc9c60b13
multi: rename project from llm to pool 2020-09-09 19:55:10 -07:00
Oliver Gugger
8b460f6506
server: embed gRPC server
To make it possible to run the whole daemon as an external subserver in
LiT, we need to embed the gRPC server so we can register it to lnd.
2020-09-03 09:57:39 +02:00
Oliver Gugger
4953d69d9b
server: add StartAsSubserver 2020-09-03 09:57:38 +02:00
Oliver Gugger
4f6b6f01a5
server: add started flag 2020-09-03 09:57:38 +02:00
Oliver Gugger
6a8f4c74fd
server: move client startup into method 2020-09-03 09:57:37 +02:00
Oliver Gugger
5f1be840e4
server: remove cfg helper variable 2020-09-03 09:57:37 +02:00
Oliver Gugger
8605008ec1
server+run: move startup logic into Start method 2020-09-03 09:57:36 +02:00
Oliver Gugger
139be1584d
server+llmd: extract setup code into Run function 2020-09-03 09:57:36 +02:00
Olaoluwa Osuntokun
2cfcad1956
llmd: on start up only query orders that're in a non-terminal state
This lets us avoid querying the server for all orders on start up each
time.
2020-08-28 16:12:52 -07:00
Oliver Gugger
7d9e6bdce3
server: pin required lnd version, block until synced
With this commit we address two issues with the connection to lnd:
First, we didn't specify the required version of lnd even though we used
features of 0.11.0. This is fixed by pinning the version to 0.11.0
explicitly and specifying the subservers that are required to be active.
Second, we didn't wait for lnd to be synced to its chain backend. We use
the new functionality in the lndclient repo that does exactly this.
2020-08-11 19:41:02 +02:00
Oliver Gugger
978950600c
multi: update aperture, use lndclient, remove loop
To get rid of the loop dependency, we update aperture (which now houses
all the LSAT code) and use the standalone lndclient repository.
2020-08-11 19:41:01 +02:00
Olaoluwa Osuntokun
fb3f2b6f76
server: on start up, sync local with remote order state
In this commit, we add some new logic to reconcile our local order state
with what the auctioneer has on start up. However, we'll only update our
local order if the auctioneer shows the order as being cancelled. For
all other cases, we should reconcile that difference if we have a
pending batch that was confirmed while we were offline, or confirmed
after we sent our signature. In this case, we'll log the order nonce
with a warning log-level so users can track down any possible issues.
2020-08-04 18:21:05 -07:00
Oliver Gugger
7ab3b587bd
server: add LSAT store to struct
As a preparation to be able to interact with the LSAT store on the RPC
level, we need to hold a reference to it in the server. So far we also
don't pass the client DB to the RPC server but instead access it through
the server struct. We do the same for the LSAT store.
2020-08-03 11:08:54 +02:00
Olaoluwa Osuntokun
18a825d935
server: add new unary+streaming interceptors to log all RPC errors 2020-07-01 17:52:05 -07:00
Olaoluwa Osuntokun
57fa63c237
multi: rename, fix modules 2020-06-21 19:37:00 -07:00
Olaoluwa Osuntokun
7c9c6dfe2d Merge pull request #84 from Roasbeef/client-fix
client: ensure the auctioneer client is started
2020-05-22 15:29:17 -07:00
Oliver Gugger
8785596960 client: add config option to disable LSAT 2020-05-20 13:53:06 +02:00
Olaoluwa Osuntokun
e691b4dac8 client: ensure the auctioneer client is started
In the integration tests, we start the client manually as part of the
set up process. When the trader is run in a standalone manner, we still
need to ensure the client is started, otherwise the auth handshake can't
take place.
2020-05-19 17:43:28 -07:00
Olaoluwa Osuntokun
55bc067f1d client: add logic to register funding shims and open chans in batch lifecycle
In this commit, we add the missing logic to register for funding shims
when we're the taker of an executed order, and also to establish new
channels after we send OrderMatchAccept when we're the maker of an
executed order.
2020-05-07 19:37:05 -07:00