Commit graph

739 commits

Author SHA1 Message Date
Oliver Gugger
71b7f419d8
order+funding: use correct multisig key
If we're the provider of a sidecar channel then we don't actually have
the private key of the funding multisig key. Therefore we cannot
re-derive it on demand and have to use the key provided in the sidecar
ticket instead.
2021-04-06 13:41:49 +02: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
ada216c561
funding: add SidecarBatchChannelSetup
If we are the receiver of a channel, all we have to do in the channel
setup (OrderMatchSign) step is wait for all expected channels to be
opened to us in time.
2021-04-06 13:36:31 +02:00
Oliver Gugger
8d9371e962
auctioneer+auctioneerrpc: add SubscribeSidecar server RPC 2021-04-06 13:36:31 +02:00
Oliver Gugger
2b46e31e6c
multi: add sidecar ticket to RPC bid order
The local database can now store a sidecar ticket with a bid order. We
now also need to accept it on the local RPC interface and forward it to
the auctioneer.
2021-04-06 13:36:30 +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
Johan T. Halseth
e480bbad38
Merge pull request #242 from lightninglabs/sidecar-prepare-refactor
sidecar channels 2/3: non-functional preparations for sidecar channels
2021-04-06 13:35:23 +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
ae5da2c92f
funding+rpcserver: move pending chan sub to funding mgr
As a preparation to be able to serve the pending channel updates from
lnd to multiple internal subscribers, we move the handling of those
events to the funding manager itself.
2021-04-02 14:18:12 +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
2a10b52f73
rpcserver: extract marshallChannelInfos
As a preparation to reuse that code in the sidecar acceptor, we extract
it into its own function.
2021-04-02 14:18:12 +02:00
Oliver Gugger
66fd38a46a
funding+rpcserver: use order fetcher instead of DB directly
To prepare for accepting sidecar channels where we don't have a real
order item in our local database, we use the order fetcher function in
the funding manager instead of the DB directly. That way we can pass in
fake bid orders during the sidecar acceptance.
2021-04-02 14:18:11 +02:00
Oliver Gugger
44fadace7a
funding: extract waitForChannelOpen method
The channel funding process for a sidecar channel will look different
from the normal process. To avoid too much code duplication, we first
extract the parts that remain the same into its own method.
We no longer need to hold a mutex since when we get to the
waitForChannelOpen method all previously spawned goroutines must have
completed.
2021-04-02 14:18:11 +02:00
Oliver Gugger
f56eb50981
auctioneer+account: rename SubscribeAccountUpdates
The name SubscribeAccountUpdates could indicate that this is a
long-running operation. The method returns after successful
authentication of the stream though. That's why we rename it to
StartAccountSubscription and update the comment to make it more clear
that this should return after a few seconds at the most.
2021-04-02 14:18:11 +02:00
Oliver Gugger
f81a1c3cfa
sidecar: add order verification 2021-04-02 14:18:11 +02:00
Oliver Gugger
2f56378898
order+clientdb: add sidecar ticket to bid order
With this commit we add the optional sidecar ticket to bid orders.
Because the node submitting the bid order doesn't necessarily need to be
the node creating the offer, we just store the ticket as is and don't
require it to be in the database already.
2021-04-02 14:18:10 +02:00
Oliver Gugger
a6f5c60020
sidecar: add signing and verification functions
For maximum re-usability of the signing/verifying code, we add them as
helper methods to the sidecar package itself.
2021-04-01 22:34:07 +02:00
Oliver Gugger
f84debaeff
sidecar+clientdb: add sidecar storage
Both the trader offering to buy a sidecar channel for another node as
well as the recipient node will need to store the involved sidecar
tickets in their local databases. We add a simple store interface and
its implementation that will be used in future commits.
2021-04-01 22:34:07 +02:00
Oliver Gugger
363ddd5a8e
sidecar: add multisig key index and lease duration
For proper and safe channel acceptance the recipient node also needs to
know which key index it used for a ticket's multisig key so it can sign
the authentication flow with the auctioneer correctly (which takes a key
locator and not key descriptor).

To make the offer and sidecar contract more explicit, we also include
the lease duration in blocks in the offer part. This field will
overwrite any value set when using the CLI to submit the bid order.
2021-04-01 22:34:07 +02:00
Oliver Gugger
b81cd319b2
docs: describe sidecar channels
With this commit we add a first description and HOWTO about what sidecar
channels are and how they can be created.
We add this commit first to give any reviewer the full context about
what we're trying to achieve first.
2021-04-01 22:34:06 +02:00
Olaoluwa Osuntokun
6066120899
Merge pull request #232 from lightninglabs/self-chan-balance
sidecar channels 1/3: Allow self channel balance on bid orders
2021-04-01 11:10:27 -07: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
74bc2f21b3
funding: add NotifyShimCreated callback
We'll add a channel acceptor in the next commit that verifies self chan
amounts for incoming channels. We need to notify that acceptor about new
funding shims that we register when receiving new order matches.
Otherwise the acceptor won't be aware of the bids and their current
pending channel ID.
2021-03-19 16:50:33 +01:00
Oliver Gugger
cf02df0745
funding+rpcserver: move nodeHasTorAddrs to funding
We can simplify the funding manager's interface by moving the
nodeHasTorAddrs method to the funding package.
2021-03-19 16:50:33 +01:00
Oliver Gugger
7e957392b5
funding: fix error message 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
fc09828d95
doc+mod: update to lndclient v0.12 2021-03-19 16:50:32 +01:00
Oliver Gugger
0508c54916
funding: set push amount when opening channel
Now that we have the self channel balance populated on the bid orders
and have also validated all diffs, we can set the push amount when
opening the channel as asker.
2021-03-19 16:50:32 +01:00
Oliver Gugger
0a5096ac55
order: validate self chan balance in deltas
When validating a batch we need to make sure that all three parties
(maker, taker, server) come up with the same account ending state after
matching a bid order with a push amount.
2021-03-19 16:50:32 +01:00
Oliver Gugger
2a790a1884
multi: add self chan balance to order submission RPCs
With everything prepared we now parse the self chan balance from the
client request and set it on the server request.
2021-03-19 16:50:31 +01:00
Oliver Gugger
8d9677e796
cmd/pool: add self_chan_balance to bid order submission
We update the bid order submission CLI and add the --self_chan_balance
flag that will request an initially balanced channel to be leased.
To make sure that askers can signal that they understand that new
feature, we also bump the submitted order version for ask orders.
2021-03-19 16:50:31 +01:00
Oliver Gugger
b308f2ee35
clientdb: add self channel balance to bid order
With the additional data encoded as tlv, we can simply add the new
self channel balance field to the tlv stream.
2021-03-19 16:50:31 +01:00
Oliver Gugger
cbacb85f45
order: add SelfChanBalance field to bid orders
With this commit we add the new SelfChanBalance to the bid order. We
also add a new version for orders that signals compatibility with that
new field. A version increase on the ask side is needed to make sure the changes in
the asker's account balance are interpreted correctly on batch
validation.
2021-03-19 16:50:31 +01:00
Oliver Gugger
761226144a
sidecar: add push amount checks
We'll need to check the self chan balance (a.k.a. push amount) values in
several places, including the upcoming sidecar ticket functionality
itself. That's why we add these check functions to the sidecar package.
2021-03-19 16:50:30 +01:00
Oliver Gugger
8f817aba5f
clientdb: add extra data as tlv stream to order
To make it way easier to add more data to orders, we add an extra key
in the order's bucket that will contain all future additional data
encoded as a tlv stream.
The PR containing this commit will likely become quite large as is and
therefore we don't want to overload it more by also adding a DB
migration. This can always be done in the future.
2021-03-19 16:50:30 +01:00
Oliver Gugger
660801b537
auctionerrpc+poolrpc: add self_chan_blance field 2021-03-19 16:50:28 +01:00
Oliver Gugger
073fe0d369
Merge pull request #237 from lightninglabs/market-info-thread-through
Add market info to getinfo call
2021-03-18 09:33:20 +01:00
Oliver Gugger
30bf63635c
auctioneer+poolrpc+rpcserver: add market info to getinfo call
With the server now exposing this new RPC, we want to add the output of
it to the getinfo call to give users an idea what the current market
situation looks like.
2021-03-17 13:08:48 +01:00
Oliver Gugger
3b99e91680
auctioneerrpc: add MarketInfo call
The server side added a new RPC that delivers information about the
current market. We add it to our proto so we can use it.
2021-03-17 10:38:42 +01:00
Olaoluwa Osuntokun
26debc66f9
Merge pull request #231 from lightninglabs/issue-template
GitHub: add issue templates
2021-03-09 18:59:36 -08:00
Oliver Gugger
52adbec87e
GitHub: add issue templates
To make initial triage easier and nudge people into reading the
documentation and gathering information before submitting an issue, we
add three issue templates: bug reports, feature requests and "other".
2021-03-09 11:12:11 +01:00
Grisha Lyukshin
d94acd702a
docs: update account close example (#229)
* Updated for a transaction close

* adding an extra line at the end of the file.

* sat_per_byte value update

As per PR review feedback, updating from 0 to something more realistic, like 11 sats per vbyte.

Co-authored-by: root <root@pop-os.localdomain>
2021-03-08 13:08:14 +01:00
Johan T. Halseth
79ad156ce4
Merge pull request #230 from guggero/newnodesonly-flag
rpcserver+poolrpc: expose state of --newnodesonly flag in RPC
2021-03-05 09:54:42 +01:00
Oliver Gugger
ffd2613b0f
rpcserver+poolrpc: expose state of --newnodesonly flag in RPC
With this commit we expose the state of the global --newnodesonly flag
of the Pool daemon in the GetInfo RPC call.
2021-03-04 16:34:37 +01:00
Oliver Gugger
c0a59f2640
Merge pull request #217 from guggero/tlv-ticket
sidecar: add ticket with TLV encoders
2021-03-01 10:05:26 +01:00
Oliver Gugger
00ac0e512e
Merge pull request #224 from lightninglabs/lit-integrated-shutdown-fix
Provide default value for lnd macaroon path, fix shutdown panic in LiT
2021-02-24 12:57:26 +01:00
Oliver Gugger
c0235be121
version: bump to version v0.4.3-alpha 2021-02-24 12:43:17 +01:00
Oliver Gugger
34d2fe52a3
config: provide default value for lnd macaroon path
To make it easier for users with everything installed to the default
locations to use Pool, we add a default value for the macaroon path.
2021-02-24 09:49:45 +01:00