Commit graph

121 commits

Author SHA1 Message Date
positiveblue
d30a0b213c
multi: update lnd and lndclient v0.15.1-beta 2022-10-18 04:34:20 -07:00
positiveblue
037671287e
account/manager: fix np2wkh deposits
The `.UnsignedTx` of a psbt does not include the related
SignatureScripts. Because SignatureScripts are not part of the signed
data, the partial signature for a psbt that does not include them is a
valid signature. However, the `TxHash` will change between a tx that has
SignatureScripts set and one that does not.

This behaviour led the auctioneer and the client to record the wrong
outpoint when using np2wkh.
2022-09-12 17:20:12 +02:00
Oliver Gugger
312e206dac
multi: implement taproot accounts 2022-09-12 17:20:11 +02:00
Oliver Gugger
355e0577f8
account: refactor account manager tests 2022-09-12 17:20:11 +02:00
Oliver Gugger
bec62efa71
account: refactor away spend package
With this commit we streamline the signing code somewhat to make it
easier to understand. With the new flow the spendPkg struct is no longer
needed as we directly pass back the (partially) signed TX.
2022-09-12 17:20:11 +02:00
Oliver Gugger
b6013e34e6
account: use spend witness type everywhere 2022-09-12 17:20:11 +02:00
Oliver Gugger
a63985d614
multi: add account version to RPCs and manager 2022-09-12 17:20:10 +02:00
Oliver Gugger
69d3ad6d44
poolscript+account+log: add new Taproot scripts 2022-09-12 17:20:10 +02:00
Oliver Gugger
7bc48a7a7d
account+clientdb: add version to account 2022-09-12 17:20:10 +02:00
Oliver Gugger
986d889b74
multi: fix linter issues 2022-08-03 20:33:06 +02:00
Oliver Gugger
fd3676f056
account: assert min lnd version for np2wkh 2022-06-30 16:18:32 +02:00
Oliver Gugger
232578a7ac
account+poolscript: assert minimum relay fee 2022-06-30 16:18:32 +02:00
Oliver Gugger
685a13daf1
account: refactor expiry witness path 2022-06-30 15:39:48 +02:00
Oliver Gugger
74d2ae48b2
account: use PSBT for account signing 2022-06-30 15:39:44 +02:00
Oliver Gugger
7571464968
multi: add chain params and lnd version to account manager 2022-06-30 13:46:59 +02:00
Oliver Gugger
56eb099eb2
multi: bump to latest lnd and lndclient versions 2022-06-17 14:50:58 +02:00
Oliver Gugger
1ba717c741
account+rpcserver: bump account key index on recovery
Fixes #372.
This commit fixes the issue that if the lnd node the trader client is
connected to was also restored from seed, it is starting at account key
derivation index 0. So when recovering accounts we need to make sure we
re-derive the right number of keys from the wallet in order to allow
properly creating new accounts with the recovered node.
2022-06-15 13:23:31 +02:00
Oliver Gugger
3508d7b9a4
multi: bump to latest lndclient and lnd versions 2022-06-01 16:16:57 +02:00
positiveblue
573f86dc83
mod: update lndclient to use new SignOutputRaw 2022-04-04 11:35:20 +02:00
positiveblue
6027ccd3d6
multi: bump btcec/v2 and btcutil to new versions 2022-03-28 15:22:41 +02:00
Oliver Gugger
d962f6624a
account: fix log message 2022-01-28 12:24:36 +01:00
positiveblue
18b9efdff6
account: add tests for account recovery 2022-01-27 23:37:29 -08:00
positiveblue
ac0a554d7d
account: implement client side recovery process 2022-01-27 23:37:24 -08:00
positiveblue
baf2042a0b
account: client side recovery skeleton 2022-01-27 23:01:37 -08:00
positiveblue
7f849b3248
account/recovery: add struct for auctioneer data
Add a new type (`auctioneerData`) containing the auctioneer data for
each evironment (mainnet, testnet and regtest).
2022-01-26 01:17:31 -08:00
positiveblue
da2108cc82
account: add target to GenerateRecoveryKeys
The default value for server assisted is 500 but the user is able to
give us a hint of how many accounts we are looking for.
2022-01-26 01:17:31 -08:00
positiveblue
65157959b0
account: generate mocks for account/interfaces.go 2021-12-14 20:40:02 -08:00
positiveblue
29135cf864
account: add the account Manager interface 2021-12-14 20:40:02 -08:00
positiveblue
1856f798fc
account/watcher: add ExpiryWatcher tests 2021-12-07 12:22:38 -08:00
positiveblue
17e77c380f
account/watcher: add controller tests 2021-12-07 12:22:37 -08:00
positiveblue
739498543a
mocks: add account/watcher mocks 2021-12-07 12:22:37 -08:00
positiveblue
7b53791997
account/watcher: delete expiryReq 2021-12-07 12:22:37 -08:00
positiveblue
abd603d765
account/watcher: add ExpiryWatcher and EventHandler interfaces
Split watcher logic in three pices:
    - Controller: API + message dispatching
    - ExpiryWatcher: handle account expirations
    - EventHandler: implementation for each handler
2021-12-07 12:22:27 -08:00
positiveblue
a34790e494
account/watcher: add Controller interface
Use the new watcher interface in the account manager instead of of a specific
struct type.
2021-12-07 11:58:40 -08:00
positiveblue
2e724ad4d6
account: disable renewAccount for StatePendingBatch status
If the account is currently participating in a batch
(`StatePendingBatch`) we disable the renewAccount command. After
enabling account autorenew it could be problematic to renew your
account before the batch is confirmed and you account expiry height
gets updated.
2021-12-02 22:54:12 -08:00
positiveblue
dae849c332
account: support expiry update for deposits/withdraws 2021-11-09 17:58:43 -08:00
Olaoluwa Osuntokun
d5f944e3fa
build: update to pin against current lnd v0.14.0 2021-10-20 19:25:48 -07:00
Jordi Montes
d493378fb5
account: check valid signer when resuming accounts
If `poold` is using a different `lndclient.SignerClient` than the one
used during an account creation it won't be able to generate valid
signatures. `poold` wasn't checking the signatures before sending them
to the backend and it was sending invalid
`ClientAuctionMessage_Subscribe` messages.

With this change `poold` will detect invalid signatures before sending
them, instead of waiting for the backend to send back an error.
2021-10-20 10:40:05 -07:00
positiveblue
68a38b34d7 account: use raw sat/byte when making an account
Generally the confirmation target is much less granular than a direct sat/byte
due to jumps in the confirmation confidence intervals. Changed the
account manager to take the `feeRate` instead of the `confTarget`. The
caller will be the one with the responsability of calculating the
`freeRate`. If the caller does not provide a value (`freeRate=0`) we
will calculate it from the default confTarget (6 blocks).
2021-09-29 21:14:08 -07:00
carla
234f4d80fb
gomod: bump to lndclient 13-7
This commit bumps pool to lndclient 13-7 so that code that depends
on lnd 0.13 can import pool. As is, pool is running with lndclient 0.12,
but pins minimum version to 0.11, so we are already in a state where
some of the apis available at compile time are not enforced by minimum
run version.

This commit bumps this minimum version up to 0.12 to minimize the
difference between the compile and runtime lnd version.
2021-08-20 16:49:41 +02:00
Oliver Gugger
f56eb50981
auctioneer+account: rename SubscribeAccountUpdates
The name SubscribeAccountUpdates could indicate that this is a
long-running operation. The method returns after successful
authentication of the stream though. That's why we rename it to
StartAccountSubscription and update the comment to make it more clear
that this should return after a few seconds at the most.
2021-04-02 14:18:11 +02:00
Oliver Gugger
52131d8690
manager: distinguish between lnwallet and btcwallet/wallet err
Unfortunately there are two error messages that are very similar (the
only difference is "doesn't" vs. "does not") and can both be returned,
depending on the code path taken.
2021-01-11 13:19:11 +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
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
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