Commit graph

37 commits

Author SHA1 Message Date
Olaoluwa Osuntokun
177e84f35a
funding: fix stream handling issues in consumePendingOpenChannels
In this commit, we fix a few issues with the streaming handling:
  1. If it got an error on Recv() it would just spin for ever,
generating an endless stream of spammy logs.
  2. It never listened on the Done() context channel for the stream. So
if the `lnd` had actually hung up, it wouldn't detect that and would
just keep spinning.

To make things more graceful, we also add back off when we try to
reconnect.
2025-07-01 17:59:02 -07:00
Elle Mouton
6dd03c0edc
multi: update lnd, aperture and lndclient deps
This includes upgrading the logging framework to the V2 framework. This
new framework lets us deprecate the `maxlogfiles` and
`maxlogfilesize` config options.
2025-03-05 12:31:15 +02:00
Oliver Gugger
52cdb3d5f9
multi: add simple taproot channel type to order 2023-10-25 10:04:23 +02:00
positiveblue
9686cad8ad
funding: log lnd returned errors from FundingStateStep 2022-11-07 08:06:22 -08:00
positiveblue
e5d78fd3cb
multi: update order/batch verification for outbound liquidity auctions 2022-10-25 05:42:18 -07:00
positiveblue
40b2cfdd07
sidecar: new version for unannounced/zero conf channels
A sidecar ticket will always use the minimum version needed to encode
all the relavant information for that offer. In that way the tickets
from a provider with a newer version can be redeemed by recipeients
using older versions as long as the ticket does not encode new
functionalities.
2022-10-18 04:34:22 -07:00
positiveblue
cdb92e11f0
multi: new batch version for unannounced channel and zero conf support 2022-10-18 04:34:21 -07:00
Oliver Gugger
986d889b74
multi: fix linter issues 2022-08-03 20:33:06 +02:00
Oliver Gugger
d16eb252e3
funding: don't abort if cleanup fails
If we can't clean up pending channels from a previous batch attempt,
that shouldn't block startup. So instead of shutting down, we just log
the warning and continue.
2022-07-15 16:48:59 +02:00
positiveblue
6027ccd3d6
multi: bump btcec/v2 and btcutil to new versions 2022-03-28 15:22:41 +02:00
Wilmer Paulino
bc49e79e72
funding: support opening script enforced channels based on order matched 2021-11-02 16:47:58 -07:00
Oliver Gugger
429b28b110
multi: prepare for upcoming lnd v0.14.0-beta release 2021-10-20 19:25:54 -07:00
Olaoluwa Osuntokun
05cb020997
rpc: add automated sidecar negotiation for the recipient
In this commit, we add automated sidecar negotiation for the recipient.
We'll use the new expose mailbox system to communicate with the provider
of the ticket to incrementally transform and complete it.

We add a new state machine attached to the sidecar acceptor that drives
the sidecar ticket to completion. We have two main states to handle:
sending the ticket w/ our node's information to the provider, and then
waiting for the final ticket from the provider that contains the order
information.

rpc: add automated ticket negotiation for the sidecar provider

In this commit, we add automated ticket negotiation for the sidecar
provider. The provider's state machine is a bit more involved as it
needs to do more in order to finalize the ticket. It starts by making a
new stream, and waiting for the recipient to send over the sidecar
information with their node information. From there it submits the bid,
checkpoints the state, and then adds the bid information before sending
the ticket back to the recipient.
2021-05-09 19:25:06 -07:00
Olaoluwa Osuntokun
2dcc903495
sidecar: update ticket w/ new offer field to indicate auto negotiation 2021-05-09 19:24:56 -07:00
Olaoluwa Osuntokun
c9640659cc
funding: sign offered ticket w/ trader account key
This change allows us to later use a ticket as a means to authenticate
communication between the provider and the recipient of a sidecar
channel.
2021-05-09 19:24:54 -07:00
Oliver Gugger
33c04894a0
funding: skip match prepare part as sidecar provider
If we're the provider of a sidecar channel we don't have to register a
funding shim or connect out to the taker. We'll just have to provide the
signature in the next step.
2021-04-06 13:41:50 +02:00
Oliver Gugger
7674551331
funding: don't wait for sidecar channels as provider
If we're the provider of a sidecar channel we don't have to wait for an
incoming channel as that won't be opened towards us. Therefore if there
are only sidecar channels in a batch, we don't have to wait at all.
2021-04-06 13:41:50 +02:00
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
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
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
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
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
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
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
83b458b504
multi: move auctioneer proto to auctioneerrpc package
As a preparation to extract the auctioneer proto package into its own
sub-module, we move it out of the poolrpc package.
2021-01-22 10:41:44 +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
f936a70317
funding+rpcserver: extract channel cleanup into funding mgr
Since it's ultimately the funding manager's job to clean up
non-finalized pending channels and/or funding shims, we move that
functionality into the manager now.
2020-12-09 09:16:43 +01:00
Oliver Gugger
4a728a864c
funding: use base client
To make testing easier and give the funding manager access to the
freshly refactored cleanup functions, we switch them over to use the
funding manager's base client interface instead of the full RPC client
interface.
2020-12-09 09:16:42 +01:00
Oliver Gugger
02cd3ffa28
multi: move cleanup functions to funding package
To delegate the pending batch cleanup to the funding manager, we first
need to move the cleanup functions into the funding package.
2020-12-09 09:16:42 +01:00
Oliver Gugger
5a60adc605
funding+rpcserver+log: move funding manager to own package
To not clutter the main package namespace with too much functionality,
we move the funding manager into its own package.
2020-12-08 11:25:12 +01:00