Commit graph

26 commits

Author SHA1 Message Date
positiveblue
a66a63e895
fmt: run go fmt
Since v1.19.0 `go fmt` also formats comments. This commit is only to
ensure that `go fmt ./...` does not modify any of our commited files.
2023-01-06 01:53:15 -08:00
positiveblue
6ff4a1de34
multi: parse and propagate unannounced/zero conf fields for sidecars 2022-10-18 04:34:22 -07:00
Oliver Gugger
986d889b74
multi: fix linter issues 2022-08-03 20:33:06 +02:00
Oliver Gugger
bd58d1e036
multi: improve trace logging 2022-06-17 14:51:02 +02:00
positiveblue
6027ccd3d6
multi: bump btcec/v2 and btcutil to new versions 2022-03-28 15:22:41 +02:00
positiveblue
cb86b2c0ed sidecar: sendRejectBatch populates the right error 2022-03-04 12:27:36 -08:00
positiveblue
af0ceb3a83 sidecar: remove shims after rejecting a batch 2022-03-03 21:50:12 -08:00
positiveblue
d2cd76a65e sidecar: clean old shims for orders in current batch 2022-02-24 13:45:41 -08:00
Oliver Gugger
262eb198c5
multi: inform other side about ticket cancellation
To avoid the other side waiting for an update for a ticket that will
never come if it is canceled, we inform them instead.
2021-10-29 17:20:18 +02:00
Oliver Gugger
811c6df4cf
sidecar+acceptor: add IsTerminal to ticket state 2021-09-29 15:15:25 +02:00
Olaoluwa Osuntokun
9a359dbc27 sidecar: clean up sidecar state for provider
When the provider gets a finalize for a matching ticket, then we'll try
to trigger the main state machine to exit.
2021-05-25 19:44:09 -07:00
Olaoluwa Osuntokun
9efd03df6f
sidecar: only restart sidecar negotiator if ticket still active 2021-05-25 12:31:45 -07:00
Olaoluwa Osuntokun
c1c67195ed
sidecar: shutdown receiver's negotiator after batch finalize 2021-05-24 22:29:02 -07:00
Olaoluwa Osuntokun
3b4a2cdcb9
sidecar: maintain set of negotiators to ensure graceful shutdown
In this commit, we being to collect a map of all the negotiators so we
can ensure that if the main daemon needs to shutdown, then they do as
well.
2021-05-24 22:28:59 -07:00
Olaoluwa Osuntokun
2e99941389
sidecar: abstract automated negotiation into new struct
In this commit, we extract the existing automated sidecar negotiation
functionality into a new struct. This is strictly a refactoring change
intended to allow the core code to be more easily unit tested as all
interaction now behind a set of interfaces permitting greater
testability via mocks.
2021-05-24 22:28:47 -07:00
Olaoluwa Osuntokun
d60b991b6f
sidecar: insert missing continue during auto sidecar restart
A continue was missing that would cause the loop to panic below as in
certain cases the recipient isn't yet present (provider just restarted).
2021-05-24 22:28:42 -07:00
Olaoluwa Osuntokun
3e41af988e
sidecar: move sidecar logic to new file, properly handle retransmission
In this commit, we move most of the sidecar logic to a new file, and
also tweak each of the main state machines to be able to properly handle
retransmission events by both sides. When the provider restarts, it'll
send over a plain offered ticket, which'll prompt the receiver to
re-send their registered ticket. When the receiver restarts, it'll
re-send its registered ticket, which'll prompt the provider to re-send
their ordered ticket.
2021-05-09 19:25:23 -07: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
4c1aac0338
sidecar: on start up, relaunch state machines for in progress auto tickets 2021-05-09 19:25:08 -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
2eb41fb90f
sidecar: modify RegisterSidecar to return modified ticket
In this commit we remove the mutation from `RegisterSidecar`. Rather
than modify the sidecar ticket, we instead accept a copy and return a
modified copy. This makes the control flow of future changes easier to
follow.
2021-05-09 19:25:04 -07:00
Olaoluwa Osuntokun
d0390b4c2c
server: add new config for sidecar acceptor 2021-05-09 19:25:02 -07:00
Oliver Gugger
44dc381573
sidecar_acceptor: resume pending tickets on startup
In case we have to restart in the middle of expecting a sidecar channel,
we have to resume all pending tickets on startup.
2021-04-06 13:41:50 +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
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