Commit graph

28 commits

Author SHA1 Message Date
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
Wilmer Paulino
f71adf7b67
multi: re-purpose account close tx field to latest tx 2020-09-02 12:10:23 -07:00
Wilmer Paulino
a532b04246
account: introduce fee expressions for account closure
We introduce two distinct ways traders can express their closing
transaction fees: a single address/output script along with a fee rate,
or a list of outputs (script and value) which implicitly expresses the
transaction fees. This provides traders with greater coin control
flexibility, allowing them to directly send their account funds to their
desired destinations efficiently without needing multiple transactions.
2020-08-24 13:33:16 -07:00
Oliver Gugger
36f50534dd
account: query auctioneer for max acct size 2020-08-18 13:38:34 +02:00
Oliver Gugger
a662b907d2
multi: add account state for pending batch update
To track whether or not an account was recently involved in one or more
batches, we need to add a new pending state. This pending state is
different from the normal pending update from a balance modification as
the auctioneer allows an account in this state to participate in a
batch. A scenario is possible where an account was involved in two or
more consecutive batches that both aren't confirmed on chain yet. To
handle that special case we need to also track the special account state
on the trader side.
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
6692073e89
clientdb+account: add code for migration-less new database fields
In the future we might want to have the possibility to add additional
fields to a database object (like orders or accounts) without the need
for a migration. We add the code for that already, even if it's not
being used currently.
2020-08-03 11:08:48 +02:00
Oliver Gugger
c7dd0ebb57
clmrpc+rpcserver+account: add conf target, check wallet balance
To make sure we don't run into an error when actually sending the
desired amount to an account output, we invoke lnd's fee estimation RPC
to make sure we can construct a transaction that also respects the new
fee parameter.
2020-07-31 14:37:06 +02:00
Wilmer Paulino
fb219d5879
account: update account height hints for non-batch operations 2020-07-01 17:00:58 -07:00
Oliver Gugger
9e55d476ff
clmrpc+account+rpcserver: add state recovery failed
Add a new client side state that denotes that account recovery for a
certain account failed.
2020-06-25 09:26:36 +02:00
Oliver Gugger
beaa9f49c3
account+auctioneer: send expiry and trader key in reservation 2020-06-25 09:17:37 +02:00
Olaoluwa Osuntokun
57fa63c237
multi: rename, fix modules 2020-06-21 19:37:00 -07:00
Wilmer Paulino
7c0a5070ea account: add support for lnd-backed account deposits 2020-06-17 18:34:53 -07:00
Oliver Gugger
909a5bbc3e client: send account value on account reservation 2020-05-27 14:57:55 +02:00
Oliver Gugger
f110e8b948 client: use key descriptor to subscribe to account
The account subscription doesn't need access to the full account,
only its key descriptor. This is a preparation for the account
recovery where we want to subscribe to the auctioneer but don't have
the full account anymore.
2020-05-14 15:56:06 +02:00
Wilmer Paulino
e6727852d0 clmrpc: extend account modification parameters provided to auctioneer 2020-05-08 14:25:41 -07:00
Wilmer Paulino
6e07921286 account: add deep Copy method 2020-05-08 13:33:43 -07:00
Wilmer Paulino
043a9f7d98 account: properly handle spend on pending batch not finalized
This commit aims to address a current gap within the system where trader
account states can become desynchronized if they participated in a batch
and they never received a Finalize message from the auctioneer.

From now on, if an account spend arrives while a trader has a pending
batch, then we assume they weren't able to receive its Finalize message,
and use the spend as an indication that the batch has been finalized.
This works because if a trader signs for a batch and disconnects, the
batch should have already been persisted, and if the batch was actually
finalized (i.e., broadcast without any changes), then the account should
have been spent.
2020-05-05 13:53:32 -07:00
Wilmer Paulino
8a38d2ad2e account+order: use proper account batch key when storing batch 2020-04-20 11:45:16 -07:00
Wilmer Paulino
10239c5c4b multi: add StatePendingUpdate 2020-04-20 11:45:12 -07:00
Oliver Gugger
30faf6188b client: add batch persistence 2020-04-03 21:53:04 +02:00
Oliver Gugger
7579b158fc client: implement stream RPC 2020-03-04 15:11:08 +01:00
Wilmer Paulino
9bf50766f7 multi: allow account closure through expiration and multi-sig paths
Traders are now able to close their accounts, whether or not they have
already expired, to arbitrary outputs or to a wallet output by default.
If an account hasn't expired, then the auctioneer's signature of the
closing transaction is required to successfully close the account.
2020-02-05 12:09:47 -08:00
Wilmer Paulino
f9faebc842 account: mark accounts as expired once their expiry is reached
Accounts in this state remain in it until they're renewed or closed.
These functionalities will be added at a later time.
2020-02-05 12:09:11 -08:00
Wilmer Paulino
4021b2919c multi: tweak trader key with shared secret and per-batch key
In this commit, we overhaul the keys used in the multi-sig construction
of an account to prevent script reuse and provide plausible deniability
between account outputs to third parties. This is done by tweaking the
trader's key with two new components:

1. A per-batch key, which is obtained from the auctioneer during account
creation. Every time the account is modified or participates in a
cleared batch within the system, the per-batch key is incremented by the
curve's base point, resulting in a different key used in the account
script.

2. A shared secret derived using Diffie-Hellman between the trader's and
auctioneer's base keys. By using this secret, we provide plausible
deniability to third parties with knowledge of the base keys and
per-batch key.

The resulting tweaked key for the trader is then used as the tweak for
the auctioneer's base key.
2020-01-29 13:23:15 -08: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
Wilmer Paulino
dca3f2717e account: implement account manager with support to create accounts
The account manager is a subsystem of the client that will be
responsible for management of all CLM accounts on-chain. This initial
version only supports opening accounts at the moment, but this will be
extended later on to also support closing and modifying them. Open
accounts are also watched for their confirmation and spend, though the
spend path remains unhandled.

The commit stands alone by itself, and is not yet integrated into the
server as we still need to satisfy its dependencies, which we'll do in
the following commits.
2020-01-10 16:57:56 -08:00