Commit graph

47 commits

Author SHA1 Message Date
positiveblue
e5d78fd3cb
multi: update order/batch verification for outbound liquidity auctions 2022-10-25 05:42:18 -07:00
Oliver Gugger
701b999463
multi: calculate locked value based on account version 2022-09-12 17:20:12 +02:00
Oliver Gugger
9638c8a24b
order+rpcserver: add MuSig2 batch signing 2022-09-12 17:20:12 +02:00
Oliver Gugger
986d889b74
multi: fix linter issues 2022-08-03 20:33:06 +02:00
positiveblue
0c062755a0
order: check node id filters when validating matches 2022-04-22 00:26:41 -07:00
positiveblue
6027ccd3d6
multi: bump btcec/v2 and btcutil to new versions 2022-03-28 15:22:41 +02:00
Oliver Gugger
e52b1ff5a6
rpcserver+order: make batch version configurable 2021-12-22 09:47:45 +01:00
Oliver Gugger
65045066af
rpcserver+order: refactor ErrVersionMismatch into struct 2021-12-22 09:47:40 +01:00
positiveblue
8365bfd5a8
order: add the order Manager interface 2021-12-14 20:12:40 -08:00
positiveblue
f9b444131e
order: add ExtendAccountBatchVersion support
- Add new `ExtendAccountBatchVersion` batchVersion.
- Use the right batch verification flow depending on the version.
2021-11-30 20:18:28 -08:00
Wilmer Paulino
f9c2861354
order+auctioneer: parse height hint from auctioneer's proposed batch
The auctioneer will now provide a height hint along with every proposed
batch it sends to traders. This height hint is then used by each trader
to base off their absolute lease expiration height, such that they can
agree on the same value and avoid any divergences due to block
propagation discrepancies between them.
2021-11-02 16:47:55 -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
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
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
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
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
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
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
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
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
Oliver Gugger
02bd5a7ef8
order+rpcserver: send correct RPC reject message 2020-08-24 17:47:20 +02:00
Oliver Gugger
75bf4e020a
rpcserver+order: remove funding shim on subsequent prepare
Because we have to always expect an OrderMatchPrepare to be sent
multiple times, we need to make sure we clean up our funding shims from
the previous pending batch.
2020-08-21 15:19:44 +02:00
Oliver Gugger
7fb4ef9782
order+rpcserver: enforce order duration limit and multiple 2020-08-18 13:38:35 +02:00
Oliver Gugger
3df4e2f005
multi: move FeeSchedule to terms package
As a preparation to avoid package import cycles when introducing more
generic terms, we move the FeeSchedule interface and its
LinearFeeSchedule implementation to the terms package.
2020-08-18 13:15:34 +02:00
Oliver Gugger
978950600c
multi: update aperture, use lndclient, remove loop
To get rid of the loop dependency, we update aperture (which now houses
all the LSAT code) and use the standalone lndclient repository.
2020-08-11 19:41:01 +02:00
Olaoluwa Osuntokun
9bb337f684
order: update validateOrder to only accumulate reserved vals for target acct
Without this commit, an account would at times be prevented on
submitting an order that it itself is able to handle.
2020-08-07 18:35:39 -07:00
Johan T. Halseth
5caa1f9d7f
order: require an order's Min/MaxDuration to be at least 144 2020-08-07 16:34:07 +02:00
Johan T. Halseth
81b6dd2139
order: acccount for worst case chain fee in reserved value
Use the MaxBatchFeeRate value to reserve the maximum chain fee that can
be paid by the trader.
2020-08-07 16:34:07 +02:00
Johan T. Halseth
204a442695
order/manager: check reserved value when submitting order
To check whether the account has enough balance for a new order, sum the
reserved value of all orders before submitting a new one.
2020-08-06 10:52:52 +02:00
Wilmer Paulino
283c0c6ca3
order: expose whether an ongoing batch is present 2020-07-15 15:57:38 -07:00
Olaoluwa Osuntokun
3363f8626a
order: only require advertised addressees for ask orders
In this commit, we relax the node addr requirement to only apply to
those that want to submit ask orders. If you're selling channels, then
you should be an actual routing node, meaning you're accepting inbound
connections. As a result, we now only apply this requirement, as this
allows those that needs inbound channels (putting in bids) to not be
exposed to the network.
2020-07-10 19:58:15 -07:00
Wilmer Paulino
509cb4e64e
order: update height hint for accounts in batch 2020-07-01 17:01:23 -07:00
Olaoluwa Osuntokun
57fa63c237
multi: rename, fix modules 2020-06-21 19:37:00 -07:00
Olaoluwa Osuntokun
55bc067f1d client: add logic to register funding shims and open chans in batch lifecycle
In this commit, we add the missing logic to register for funding shims
when we're the taker of an executed order, and also to establish new
channels after we send OrderMatchAccept when we're the maker of an
executed order.
2020-05-07 19:37:05 -07:00
Wilmer Paulino
15c5859239 clientdb+order: remove batch ID parameter from MarkBatchComplete
The parameter isn't necessary as traders can only maintain one pending
batch at a time, and the check is already performed by the BatchStorer.
2020-05-05 13:48:28 -07:00
Wilmer Paulino
c2ae197406 order: commit pending batch before providing signatures to auctioneer
Previously, if the connection between the trader and auctioneer was torn
down before the trader received a batch's finalize message, then the
trader would lose all context about the batch they participated in.
Committing the batch before providing our signatures to the auctioneer
ensures that this cannot happen. Follow-up work will allow the trader to
obtain the latest information regarding a pending batch upon
reconnections.
2020-04-24 10:57:42 -07:00
Oliver Gugger
30faf6188b client: add batch persistence 2020-04-03 21:53:04 +02:00
Oliver Gugger
42adb28ff5 client: verify batch 2020-04-03 21:50:22 +02:00
Oliver Gugger
ac7ad38d08 client: send batch version on connect 2020-04-03 21:50:20 +02:00
Oliver Gugger
03ea874da0 client+order: add fee calculation code 2020-03-17 13:34:27 +01:00
Oliver Gugger
4e2553ee18 client+order: rename CalcFee to PerBlockPremium 2020-03-17 13:19:49 +01:00
Wilmer Paulino
004e1cf857 multi: use btcec.PublicKey instead of [33]byte
This allows us to use utility functions that require the use of a parsed
public key without needing to parse every time.
2020-01-24 13:45:48 -08:00
Oliver Gugger
d59b603e45 client+order: store order 2020-01-17 17:41:25 +01:00