Commit graph

108 commits

Author SHA1 Message Date
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
1a68069bc2
order: add NewQuote function
We port over the order quote calculation from the CLI to the order
package so we can also offer the same calculation over RPC.
2021-05-05 15:55:45 +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
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
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
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
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
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
5a2bc0cde9
order: store local node pubkey
The order manager already stores the local lnd node's identity public
key. We return it in an exported method so the RPC server can access it
as well without needing to query it again.
To make sure we only allow querying it after the manager is started, we
add an atomic flag for the startup state.
2021-02-02 09:57:07 +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
05626355ae
multi: use distinct clearing price per duration bucket 2021-01-08 14:02:14 +01:00
Oliver Gugger
919f453651
poolrpc+order: group orders and prices by duration markets 2021-01-08 14:02:13 +01:00
Oliver Gugger
a27fd7c1a0
multi: add and use new order version
We add a new order version that is allowed to submit lease durations
outside of the default/legacy 2016 block duration.
No new fields are added, so nothing changes in the serialization or the
digest. This version only signals that the client is able to process
batch requests with multiple duration buckets.
2021-01-08 14:02:11 +01:00
Oliver Gugger
83795453c7
multi: expose duration bucket state 2021-01-08 14:02:10 +01:00
Oliver Gugger
31b832ae80
multi: remove max order duration
Because the order/lease duration is now governed by the lease durations,
the maximum order duration is no longer needed.
2021-01-08 14:02:09 +01:00
Oliver Gugger
1f265865cf
order+auctioneer: rename batch versions to avoid confusion
Because the batch Versions are in the order package, the use of
order.DefaultVersion is confusing and not clear to be related to the
version of the _batch_, just from its name. We fix that by renaming the
versions of the batch.
2021-01-08 14:02:06 +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
2cd6381e25
order: demote scary sounding warn message to debug
Since this error caused quite some confusion among our users, we demote
it to info and change the text to further explain what's happened.
If a trader is involved in a batch and the channel funding fails in the
batch sign phase, a pending channel is never created in lnd. If the next
batch prepare message comes in, we try to clean up all pending channels
of the previous attempt. Because the channel negotiation failed and
there is no pending channel, cleaning up fails with this message.
2020-12-09 09:13:42 +01:00
Oliver Gugger
43ecf1d320
order+rpcserver: refactor AbandonCanceledChannels into function
We also need to make the channel abandonment independent of a particular
format of a pending batch, so we refactor it into a standalone function
instead of a method on the in-memory batch format.
2020-12-08 11:25:13 +01:00
Oliver Gugger
aa7f4a228f
order+rpcserver: refactor CancelPendingFundingShims into function
We want to be able to clean up after a pending batch that is replaced.
We want to do this for both in-memory pending batches but also for
persisted local snapshot batches on startup. Therefore we need to
refactor the cleanup methods into independent functions.
2020-12-08 11:25:13 +01:00
Oliver Gugger
4dd9eb8c6c
order: add DecrementingBatchIDs
To make iterating over batch IDs easier, we add a new helper function
that returns all batch IDs starting at the start key (inclusive) and
ending at the end key (inclusive) by decrementing the public keys. If
the end key cannot be reached by decrementing the start key by a maximum
of 10k times, we abort and return the first 10k items (without the end
key).
2020-11-30 23:44:27 +01:00
Olaoluwa Osuntokun
e79fcb4303
Merge pull request #158 from wpaulino/account-reserved-value-underflow
order: account for last match consuming all units left in reserved value computation
2020-11-12 15:56:54 -08:00
Wilmer Paulino
85f28057b1
order: account for last match consuming all units left in reserved value computation 2020-11-12 11:40:19 -08:00
Wilmer Paulino
3e0fd5309c
order+pool: round default min chan amt to nearest unit 2020-11-11 14:28:23 -08:00
Olaoluwa Osuntokun
7744d9d4bf
Merge pull request #104 from guggero/del-order-timestamp
Update order status to "failed" instead of deleting
2020-10-13 16:21:41 -07:00
Oliver Gugger
b0dc59a39e
order+clientdb: remove unused DelOrder method 2020-10-13 10:11:37 +02:00
Wilmer Paulino
bd39dfc78f
order: mark order with unfulfilled units below min as executed 2020-10-12 19:51:32 -07:00
Wilmer Paulino
3c92676aec
order: use min units match to compute reserved value 2020-10-12 19:51:31 -07:00
Wilmer Paulino
e9031a4885
order: enforce min units match in batch verification 2020-10-12 19:51:29 -07:00
Wilmer Paulino
f45245e8fc
order+rpc: introduce MinUnitsMatch field 2020-10-12 19:51:27 -07:00
Olaoluwa Osuntokun
a65dfb9829 order: introduce new node tier system
In this commit, we introduce a new field to only bids (for now): a min
node tier. This node tier is meant to allow buyers to express the level
of "quality" they're interested in for a given purchased channel. This
quality is determined using the current server-side rating system. The
base node tier are those considered "above the cut", this is also the
default tier: t1. The next node tier is t0, and is the buckets all other
nodes fall in. As the tiers rise, the number of nodes in each tier
shrinks, as these are meant to be the upper percentile of all nodes.

NOTE: The way this is implemented is actually a _breaking change_ from
the perspective of orders as we add a new field, which is included in
the order digest, without also bumping the version.
2020-10-07 18:03:47 -07:00
Olaoluwa Osuntokun
281f2a17d2 multi: unify min/max durations into single field of LeaseDuration
In this commit, we replace the existing min/max duration system with a
single field that expresses the expected duration of a lease. Note that
we've left some of the exiting logic in place that select a duration
from a bid in an attempt to make this more of a "soft fork" which will
allow any existing orders to be cleared out as normal before we switch
over.

Once we add multiple durations (this commit assumes a single duration),
we'll need to modify the verification logic to be able to handle
multiple clearing prices for a given batch.
2020-10-05 17:57:16 -07:00
Oliver Gugger
4964dfca6c
order+clientdb: add order specific events
We add a couple of order specific events which we use to track the
activity around orders. Some events track the timestamps at which we
persist a change to orders, other events track more volatile occurrences
of the match making process.
2020-10-01 13:16:47 +02:00
Wilmer Paulino
d99201399f
multi: check tor address without port
The underlying call to tor.IsOnionHost used to detect Tor addresses
requires the host only, without the port.
2020-09-18 10:54:26 -07:00
Wilmer Paulino
d6ccb71ff9
order: check order rate against matched batch clearing price 2020-09-16 15:41:37 -07:00
Olaoluwa Osuntokun
1aaf24a4ad
Merge pull request #69 from guggero/abandon-retried-channels
Abandon replaced channels
2020-09-11 16:49:10 -07:00
Olaoluwa Osuntokun
d3fe974c03
Merge pull request #67 from Roasbeef/allow-tor-client
multi: allow traders to submit orders w/ tor addrs, adjust connection logic accordingly
2020-09-11 16:42:50 -07:00
Olaoluwa Osuntokun
691398f512
order: properly parse tor addrs in ParseRPCServerOrder 2020-09-11 16:33:43 -07:00
Olaoluwa Osuntokun
ad061cd491
order: allow tor addrs to be attached to orders
In this commit, we allow Tor addrs to be attached to orders. This will
allow clients to buy/sell channels using a Tor node, or a Tor-only node.
A follow up commit to this will adjust the client-side logic to have the
asker connect out to the bidder as well if the asker is behind a Tor
node.
2020-09-10 20:22:41 -07:00
Oliver Gugger
5a8825b8b4
order: add AbandonCanceledChannels 2020-09-10 13:47:17 +02:00
Oliver Gugger
f41043b901
order: extract channelOutput from batch verifier
As a preparation to abandon canceled channels, we first extract the
utility method to locate a channel output created in a batch from the
batch verifier into the batch itself.
2020-09-10 13:47:16 +02:00
Johan T. Halseth
0e665f592a
clientdb: store LocalBatchSnapshot on StorePendingBatch 2020-09-10 10:41:31 +02:00
Johan T. Halseth
678a52f86e
order/tradingfees: correct fixed rate parts per _billion_ comment 2020-09-10 09:51:11 +02:00
Olaoluwa Osuntokun
1e0035d3d4
multi: fix import order 2020-09-09 19:55:16 -07:00
Olaoluwa Osuntokun
ffc9c60b13
multi: rename project from llm to pool 2020-09-09 19:55:10 -07:00
Olaoluwa Osuntokun
3756d31a47
order: only require node addr for ask orders 2020-09-04 15:38:19 -07:00
Wilmer Paulino
f71adf7b67
multi: re-purpose account close tx field to latest tx 2020-09-02 12:10:23 -07:00
Oliver Gugger
02bd5a7ef8
order+rpcserver: send correct RPC reject message 2020-08-24 17:47:20 +02:00