Commit graph

82 commits

Author SHA1 Message Date
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
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
09515098f2
order: use state pending batch when storing account diff 2020-08-17 11:44:30 +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
Oliver Gugger
668bc2c279
multi: copy lndclient mocks from loop repository
As a preparation to get rid of the loop dependency, we copy the mocks we
need from the test package of that dependency and use them in our tests.
2020-08-11 10:44:24 +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
Olaoluwa Osuntokun
fcdc26afa0
order: add new TestValidateOrderAccountIsolation test case
In this commit, we add a new test that fails with the current logic in
`validateOrder`. The function as isn't doesn't isolate the orders for
each account, so the orders from account A can prevent a user from
making an order to account B.
2020-08-07 18:35:38 -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
a2abc187f3
multi: rename FundingFeeRate to MaxBatchFeeRate
The funding feerate field was previoulsy unused, so we rename it to
"max batch fee rate" in order to use it to communicate to the server the
maximum fee rate we are willing to pay to be included in a batch.

We also increase the default value to 500 sat/vbyte.
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
Johan T. Halseth
c9e6e2a3a7
order: add ReservedValue to interface
The ReservedValue method returns the worst case value the must be
available in the account to ensure the trader can pay for the order
including its fees.
2020-08-06 10:52:52 +02:00
Johan T. Halseth
93c324c35c
order: add StateExpired to Archived() 2020-08-06 10:52:52 +02:00
Johan T. Halseth
bb89eaba74
order: extract maker and taker delta calculation
To be able to re-use the caluclation for a single order without keeping
a tally.
2020-08-06 10:52:51 +02:00
Olaoluwa Osuntokun
660426609f
Merge pull request #28 from Roasbeef/billions
order: increase precision for the smallest per-block lease rate
2020-07-15 21:12:52 -07:00
Olaoluwa Osuntokun
e31c176f6c
order: increase precision for the smallest per-block lease rate
This is a follow up to #21. In this PR increase the fixed rate
denominator from 1e6 to 1e9 (a factor of 100x), which will allow us to
express a per-block lease rate for the smallest possible order (1 unit,
or 100k sats) over the longest possible lease period (6 months).
2020-07-15 16:27:07 -07:00
Wilmer Paulino
283c0c6ca3
order: expose whether an ongoing batch is present 2020-07-15 15:57:38 -07:00
Olaoluwa Osuntokun
1b498857b2
order+batch: cancel pending funding shims if we reject a batch
In this commit, we ensure that if we need to reject a batch for w/e
reason, then we also unregister all funding shims. Otherwise, if we
repeat a modified version of that batch, then we'd fail early as the
attempt to register than same shim would be rejected.
2020-07-14 20:12:43 -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
Olaoluwa Osuntokun
cd408b366c
Merge pull request #19 from wpaulino/height-hint-sweep
account+order: update account height hints
2020-07-02 17:26:23 -07:00
Olaoluwa Osuntokun
5e4149c32d
order: add String() method for order type 2020-07-01 17:52:06 -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
Oliver Gugger
c46bfef959 client+clmrpc: unify data types for amounts, fees and blocks
We use the same proto message types everywhere for these kinds
of fields:
- absolute amounts (sats): uint64
- fee rates (sat/kWU): uint64
- fee rates (ppm): uint32
- blocks (absolute and relative): uint32

Additionally we unify the comments and remove the [ json_name = "" ]
declarations in the trader proto as they aren't needed with the
jsonpb marshaller that we use.
Then we align the naming of the account key to be called trader key
everywhere instead of user's sub key.
2020-05-27 14:33:34 +02:00
Olaoluwa Osuntokun
33246cda7d multi: fix linter issues 2020-05-26 19:58:14 -07:00