Commit graph

826 commits

Author SHA1 Message Date
Oliver Gugger
edf67bc1b0
auctioneer: fix linter issue
The new version of RPC structs contains an internal lock and therefore
they shouldn't be memory copied anymore. The linter fortunately picked
up on this and warned us, so we pass in the pointer here directly
instead.
2021-07-29 14:01:24 +02:00
Oliver Gugger
938e608ab2
multi: update lnd master with grpc-gateway upgrade
To make pool work with the latest lnd version inside of LiT, we need
to upgrade the grpc-gateway library to the same v2 version here too.
2021-07-29 14:01:23 +02:00
Oliver Gugger
a81090a8ac
poolrpc+auctioneerrpc: use docker to compile protos
To pin down exactly the versions of our proto compilation tools we use,
we do the actual compilation step inside a docker container.
2021-07-29 13:40:47 +02:00
Olaoluwa Osuntokun
fcc3249b76
Merge pull request #270 from lightninglabs/server-connect
auctioneer+rpc: force a reconnection attempt on unknown error
2021-07-26 18:01:08 -07:00
Oliver Gugger
a6f7d8445e
auctioneer: retry connection (almost) forever 2021-07-23 17:15:17 +02:00
Oliver Gugger
3deb8df8be
auctioneer+rpc: react to correct error if auth fails
It turns out that on startup the auctioneer can get overwhelmed if
hundreds of traders try to authenticate all at once. So some of them run
into a timeout (which sounds like it's the trader's fault but the
timeout covers the whole 3-way handshake and is actually delayed by the
server, not the client) which wasn't handled correctly.

We now inspect the correct error if the authentication fails and try
reconnecting.
2021-07-23 17:15:17 +02:00
Olaoluwa Osuntokun
335b44e849
Merge pull request #271 from guggero/lsat-routing-fee
Bump default LSAT max routing fee and make it configurable
2021-07-01 16:53:04 -07:00
Oliver Gugger
ab46aa7a49
server+config: allow max LSAT routing fee to be configured
If users are only connected to the network through nodes with high fees
even the 5% default routing fee for the LSAT might not be enough. To
avoid them needing to compile Pool with a custom value, we expose that
value as a config option.
2021-07-01 10:44:12 +02:00
Oliver Gugger
645c8985e0
config: bump default LSAT max fee to 5%
It seems like 1% max routing fee is too small a number for a small
payment amount of 1k as a non-default base fee can already be as high
for some channels. We bump the default max LSAT routing fee to 5% to
have a better chance of finding decent routes.
2021-07-01 10:24:36 +02:00
Olaoluwa Osuntokun
d0094acbb2
Merge pull request #269 from orbitalturtle/sidecar-offer-account
cmd/pool: make sure to retrieve trader key when using sidecarOffer command
2021-06-30 14:42:53 -07:00
Turtle
8f51833c46 cmd/pool: make sure to retrieve trader key when using sidecarOffer command 2021-06-27 06:52:17 +01:00
Olaoluwa Osuntokun
5e2579001b
Merge pull request #264 from lightninglabs/sidecar-read-backoff
sidecar: add simple exponential back off for mailbox reads
2021-06-25 15:35:49 -07:00
Olaoluwa Osuntokun
24d2f6127e
sidecar: add simple exponential back off for mailbox reads
In this commit, we fix an existing issue that would cause sidecar
negotiation to halt if either the server restarted, or if the main
connection was torn down. To address this, we add a simple abstraction
that implements stateful exponential back-off that'll wait for a period
of time before trying to read from the mailbox again.
2021-06-25 14:59:11 -07:00
Oliver Gugger
8003b02b3e
Merge pull request #268 from carlaKC/leases-matchedordernonce
multi: add matched order nonce to lease
2021-06-25 15:21:45 +02:00
carla
b39f6716fe
multi: add matched order nonce to lease
Update leases to include the nonce of the order that the match was
with. This is required to match a lease with the event list provided
by an order in the case of multiple matches (and thus get a timestamp
for that lease).
2021-06-22 09:17:13 +02:00
Olaoluwa Osuntokun
9c7a58128e
Merge pull request #267 from lightninglabs/lnd-013
build: pin to lnd v0.13.0
2021-06-17 17:30:12 -07:00
Olaoluwa Osuntokun
dfb86d6568
build: pin to lnd v0.13.0 2021-06-17 17:13:13 -07:00
Olaoluwa Osuntokun
2e857462b5
Merge pull request #262 from lightninglabs/sidecar-restart-expect
sidecar: on restart ensure recipient re-expects channel
2021-05-25 23:10:22 -07: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
67f01ec1b7 sidecar: on restart ensure recipient re-expects channel
Without this extra case on restart, the recipient would have an
unhandled state transition that would cause them to not expect the
channel as it should once the batch is finalized.
2021-05-25 19:13:11 -07:00
Olaoluwa Osuntokun
ec12ec05ba
Merge pull request #261 from lightninglabs/sidecar-docs
docs: update sidecar docs w/ new auto flow
2021-05-25 18:57:13 -07:00
Olaoluwa Osuntokun
374b33952d docs: update sidecar docs w/ new auto flow 2021-05-25 16:00:40 -07:00
Oliver Gugger
e38c86d611
Merge pull request #260 from lightninglabs/sidecar-restart-fix
sidecar: only restart sidecar negotiator if ticket still active
2021-05-25 23:16:13 +02:00
Olaoluwa Osuntokun
9efd03df6f
sidecar: only restart sidecar negotiator if ticket still active 2021-05-25 12:31:45 -07:00
Olaoluwa Osuntokun
07928242d5
Merge pull request #256 from lightninglabs/lnd-0.13
Prepare for lnd v0.13.0 and upcoming LiT version
2021-05-25 11:31:37 -07:00
Oliver Gugger
91c9f74253
mod: use latest tagged version of auctioneerrpc 2021-05-25 20:25:16 +02:00
Oliver Gugger
f38eeaf933
multi: bump lnd to version v0.13.0-beta.rc3 2021-05-25 20:25:16 +02:00
Olaoluwa Osuntokun
c433c675d1
build: bump version to v0.5.0-alpha 2021-05-25 11:07:41 -07:00
Oliver Gugger
eb198db752
Merge pull request #258 from lightninglabs/sidecar-follow-ups
multi: sidecar bug fixes and additional tests
2021-05-25 14:35:51 +02:00
Olaoluwa Osuntokun
fbe1a10d9c
sidecar: add additional test case for message retransmission 2021-05-24 22:29:09 -07:00
Olaoluwa Osuntokun
c8469eb7db
sidecar: add unit tests for basic ticket negotiation and restart 2021-05-24 22:29:04 -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
026addd7cd
sidecar: add new method to allow negotiator to finalize ticket state 2021-05-24 22:28:57 -07:00
Olaoluwa Osuntokun
db646c5a49
sidecar: only simulate retransmission for provider if restarting from scratch
We only need to re-send the simulated retransmission message if we're
starting from scratch and haven't yet received the provider's message.
Otherwise, this will cause an unnecessary internal state transition.
2021-05-24 22:28:54 -07:00
Olaoluwa Osuntokun
36dbabd714
sidecar: add CurrentState() method to side car negotiator
This methods makes writing tests easier as the test context can
introspect into the negotiator's state.
2021-05-24 22:28:52 -07:00
Olaoluwa Osuntokun
3369357053
auctioneer: add client methods for HashMail stream deletion 2021-05-24 22:28:49 -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
3ca1be322e
sidecar: allow recipient ID to be derived using base offer ticket
In this commit, we fix a bug in the retransmission case for the
provider. Before this commit, the provider would attempt to re-send the
initial offer ticket on restart if it hadn't yet received the registered
ticket. This fails as the recipient's stream ID is derived from their
pubkey information that's only contained in the registered ticket.

To fix this, we'll simply use the sha512 hash of the offer sig since
it's known when the ticket is initially created.
2021-05-24 22:28:44 -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
3dee849502
clientdb: permit sub-buckets in main sidecar bucket
A prior check is now invalidated as the sidecar bucket houses a
sub-bucket that we use to store the set of bid information related to a
sidecar channel.
2021-05-24 22:28:39 -07:00
Olaoluwa Osuntokun
8b13a4290e
Merge pull request #259 from lightninglabs/new-sidecar-encoding
sidecar: switch sidecar encoding from base68 to base58
2021-05-19 20:07:11 -07:00
Olaoluwa Osuntokun
2a83726c21
sidecar: switch sidecar encoding from base68 to base58
In this commit, we change the encoding of the sidecar ticket from base68
to base58 as it doesn't contain any special characters which makes copy
pasting a string easier.

An example encoding of the new string looks something like:
```
sidecar13HtPsD1UiB2EA4ZfUbnVejG1Pu3p1GW2ydq65NZBuQgTaD9LRESHtKasXwNrQPYqkwkMyJNFiNoBig4PBQQKoKeXz5jHWXZ3pMZNX5JW2FXyf6zKTPWthRQczNQuf2pM8ppjTqHK6tYTEReZk7pFynYJoHnAeBtix28k2PiRSz5qVVmHpWHWFgVjxihEmcD1T1V1g5LwzVSRUyCJ11ajaE4nHdnU1ZR3HdduxXnyyefacfXWAts3tytr7RnWzRbnVPFSx7eVgeinknYvQ3njtiStpQpSacoBH4y1KckVpRAo8N8KuWWmAgYBNpxZfK8RsgViJ26kTpbfuyyHy1uPkAsGtv25iz5pNcopXyaXMnZGyDDWrDf9ZJEgU6wzm4VxwrPfNN4ASR6wLGWAKy1SsCMVFi5Bx6khN4ReSmJVrALWXrbgM52j7evHVRYXa1LZCJTBccCvaRXNYQqxJvnUnLnHW4N4THv4j1y94wmo2SafRfKapxppVW
```
2021-05-19 19:55:56 -07:00
Olaoluwa Osuntokun
a43019f246
Merge pull request #250 from lightninglabs/auto-sidecar
multi: implement automated negotiation for sidecar channels
2021-05-09 19:30:28 -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
42aec3fc8f
rpc: include order nonce in SidecarTicket
We add the order nonce as if automated negotiation was used, then the
order nonce (when it actually is submitted and its state) can be used to
track the ongoing sidecar ticket negotiation.
2021-05-09 19:25:18 -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
37947e5de5
cmd/pool: for sidecar offers parse complete bid if auto flag is set
Otherwise, we'll just parse out the 3 fields we actually need. Only if
the auto flag is set do we need to collect the complete bid as normal.
2021-05-09 19:25:13 -07:00
Olaoluwa Osuntokun
23b5144c47
cmd/pool: extract bid flags and parsing into new functions/variables
This sets us up to re-use these values in the next commit to parse out
the new complete set of fields that are required for a sidecar ticket.
2021-05-09 19:25:11 -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