Commit graph

640 commits

Author SHA1 Message Date
Oliver Gugger
7f1f29cf58
macaroons: pass root key ID in context 2021-01-11 13:19:10 +01:00
Oliver Gugger
54d22d41ac
multi: bump lnd dep version 2021-01-11 13:19:09 +01:00
Wilmer Paulino
7a5cd90e9a
pool: add cli command to renew account 2021-01-08 14:02:27 +01:00
Wilmer Paulino
bb4929c551
pool: set 30d expiry default for new account creation 2021-01-08 14:02:26 +01:00
Wilmer Paulino
bcdd267e22
rpc: add RenewAccount RPC 2021-01-08 14:02:25 +01:00
Wilmer Paulino
79c7bb029b
account: add support for account renewals 2021-01-08 14:02:24 +01:00
Wilmer Paulino
1fd51e4c55
account: handle StateCanceledAfterRecovery in resumeAccount 2021-01-08 14:02:23 +01:00
Wilmer Paulino
8961e9a09e
account: introduce StateExpiredPendingUpdate state
This is an intermediate state where an account has met its expiration
while having a pending update waiting for confirmation. The introduction
of this state was necessary as the existing StateExpired state was not
sufficient to handle all edge cases regarding account renewals. Now
that this state exists, we can be sure renewals cannot happen until the
account is both confirmed, unspent, and expired.
2021-01-08 14:02:22 +01:00
Wilmer Paulino
f4229a9797
account: always watch account expiry on StateOpen transition
We no longer need to track if the account expiry needs to be watched or
not as the watcher now supports updating existing unfulfilled expiry
requests.
2021-01-08 14:02:21 +01:00
Wilmer Paulino
d3dc8f9ffc
watcher: overwrite request on successive calls to WatchAccountExpiration 2021-01-08 14:02:20 +01:00
Wilmer Paulino
7d8602b0ee
watcher: use single mutex to track request cancellations 2021-01-08 14:02:18 +01:00
Oliver Gugger
da3a1ab1c6
cmd/pool: don't display deprecated fields in CLI 2021-01-08 14:02:17 +01:00
Oliver Gugger
a4369efcf2
rpcserver: return on EOF 2021-01-08 14:02:16 +01:00
Oliver Gugger
c76ae07895
clientdb: test snapshot serialization for all versions 2021-01-08 14:02:15 +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
713eba5279
clientdb: properly serialize batch version
Even though there still only is one batch version, we want to properly
encode/decode it as a preparation for future version changes.
2021-01-08 14:02:08 +01:00
Oliver Gugger
466bb45b2f
poolrpc: add batch creation timestamp to snapshot 2021-01-08 14:02:07 +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
c0f971d552
Merge pull request #197 from lightninglabs/recovery-fix
account: use latest TX from DB instead of querying lnd
2021-01-07 16:12:15 -08:00
Oliver Gugger
8e12f3b86c
auctioneer: map closed account state correctly on recovery
This commit fixes a wrong assumption the recovery was implemented with.
The auctioneer will only switch to the closed state once the closing TX
confirms. We therefore shouldn't map this to pending closed as that'll
try to re-broadcast the close TX (which fails for confirmed
transactions).
2021-01-04 18:14:18 +01:00
Oliver Gugger
262793a493
account: use latest TX from DB instead of querying lnd
To make the account manager less dependent on the wallet state of lnd,
we use the latest TX state that we now store for the account instead of
the lnd ListTransactions RPC where possible.
This fixes account recovery for lnd nodes that were restored from the
seed and don't remember/detect all Pool transactions automatically.
2021-01-04 15:34:19 +01:00
BLdotN
ae48cf330f
docs: add how to cancel orders 2020-12-09 15:52:56 -08:00
Oliver Gugger
4c555373dd
Merge pull request #184 from guggero/fix-abandon-channel
Clean up pending batch artifacts on startup
2020-12-09 10:02:51 +01:00
Oliver Gugger
671f430b88
multi: use funding manager as BatchCleaner
If we detect we have a pending batch in the local database that was
replaced by a different transaction, we try to clean up funding shims
and pending channels on startup as well.
To allow that, we use the funding manager as the BatchCleaner
implementation.
2020-12-09 09:42:31 +01:00
Oliver Gugger
5098fe1ccb
auctioneer+server: add new BatchCleaner interface
To prepare for using the funding manager to do the actual cleanup of a
pending batch, we extract the cleanup itself into a new interface.
2020-12-09 09:42:31 +01:00
Oliver Gugger
90b6e8c598
server: initialize funding manager in server
We'll soon need a reference to the funding manager in the server, so we
can pass it to the auctioneer client. To enable that, we initialize and
use it in the server instead of the rpcserver.
2020-12-09 09:42:30 +01:00
Oliver Gugger
b589cb7e70
clientdb: remove unused pending batch TX key
Because we now only use the batch TX from the local pending batch
snapshot, the redundant information in the pending batch TX key is not
needed anymore.
2020-12-09 09:42:30 +01:00
Oliver Gugger
8b57bb9a4e
multi: replace PendingBatch with PendingBatchSnapshot
To be able to fully clean up an old, pending batch snapshot on daemon
startup, we first need to switch to a method that returns the full
snapshot instead of just its ID.
2020-12-09 09:42:30 +01:00
Oliver Gugger
4b2291aaa8
clientdb: add fetchPendingBatchSnapshot
In preparation for loading the full local pending batch snapshot instead
of only the ID when starting the daemon, we add a new function to the
database to retrieve the snapshot.
2020-12-09 09:42:29 +01:00
Oliver Gugger
e07f6cbdce
Merge pull request #187 from guggero/manager-refactor
refactor: move funding manager into own package, make it clean up pending batches
2020-12-09 09:40:20 +01:00
Oliver Gugger
f936a70317
funding+rpcserver: extract channel cleanup into funding mgr
Since it's ultimately the funding manager's job to clean up
non-finalized pending channels and/or funding shims, we move that
functionality into the manager now.
2020-12-09 09:16:43 +01:00
Oliver Gugger
4a728a864c
funding: use base client
To make testing easier and give the funding manager access to the
freshly refactored cleanup functions, we switch them over to use the
funding manager's base client interface instead of the full RPC client
interface.
2020-12-09 09:16:42 +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
5a60adc605
funding+rpcserver+log: move funding manager to own package
To not clutter the main package namespace with too much functionality,
we move the funding manager into its own package.
2020-12-08 11:25:12 +01:00
Oliver Gugger
6c2deae310
fundingmgr+rpcserver: prepare to extract funding manager
We want to move the funding manager into its own package in the next
commit. This commit prepares everything we can to make the actual move
as simple as possible.
2020-12-08 11:25:12 +01:00
Oliver Gugger
4f7cfe31fc
fundingmgr+rpcserver: remove quit chan, use update chan directly
By passing in the quit channel where needed, we make the
funding manager a bit less stateful and easier to reason about.
By sending channel updates to the funding manager's update chan
directly, we also make it more clear who's responsible for processing
the updates.
2020-12-08 11:24:13 +01:00
Olaoluwa Osuntokun
d2852c13fd
Merge pull request #188 from guggero/bump-0.3.4
build: bump version to v0.3.4-alpha
2020-12-07 14:15:39 -08:00
Oliver Gugger
00c42dd87a
build: bump version to v0.3.4-alpha 2020-12-07 22:28:19 +01:00
Johan T. Halseth
91aa076044
Merge pull request #165 from guggero/batch-rpcs
Add RPC to query multiple batches
2020-12-01 12:08:10 +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
Oliver Gugger
380646704f
cmd/pool: add num_batches to snapshot command 2020-11-30 23:44:27 +01:00
Oliver Gugger
fde059c096
poolrpc: add batch query RPCs 2020-11-30 23:44:22 +01:00
Oliver Gugger
ae75931d1b
make+poolrpc: add rpc-format command 2020-11-30 23:20:51 +01:00