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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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
```
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.
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.
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.