Commit Graph
1350 Commits
Author SHA1 Message Date
yyforyongyu 22f8f6ed4a channeldb+lnwallet: save initial balances during channel opening 2022-04-20 01:18:12 +08:00
yyforyongyu 9a4589d54e lnwallet: remove unused field PendingHTLCs 2022-04-20 01:18:12 +08:00
yyforyongyu acde626ac9 lnwallet+htlcswitch: remove the redundant param in OweCommitment
This commit removes the bool param found in OweCommitment, which we
only ever use `true`.
2022-04-20 01:18:12 +08:00
yyforyongyu fcb314bf2c channeldb: add more verbose docs 2022-04-20 01:18:11 +08:00
Oliver Gugger 485d8f043d btcwallet: always make sure default scopes exist
If new default scopes are added to the underlying btcwallet
implementation, then they aren't automatically created for _existing_
wallets, only for new ones. So on startup we need to make sure all
scopes are present.
2022-03-30 12:50:16 +02:00
Oliver Gugger ef98f2df8a multi: add p2tr tapscript key path signing capabilities 2022-03-24 18:02:39 +01:00
Oliver Gugger 78db46be7e multi: add p2tr tapscript signing capabilities 2022-03-24 18:02:39 +01:00
Oliver Gugger 108f49f23b input+signer: test wallet script import 2022-03-24 18:02:38 +01:00
Oliver Gugger c73cf03a55 multi: add p2tr keyspend wallet support 2022-03-24 18:02:38 +01:00
Oliver Gugger f130eddb92 multi: use prev output fetcher where possible 2022-03-24 18:02:37 +01:00
Oliver Gugger 72c9582b85 multi: bump btcd to taproot aware version 2022-03-24 15:00:25 +01:00
Oliver Gugger 0dcaa511a2 Merge pull request #6341 from guggero/remote-signer-signoutputraw
remote signer: fix SignOutputRaw RPC for incomplete key info, fix healthcheck connection leak
2022-03-24 14:59:38 +01:00
Oliver Gugger 8c44da225a rpcwallet: fix RPC wallet health check connection leak
Fixes #6329.
This commit fixes a connection leak in the RPC wallet's health check. By
not closing the test connection the watch-only node would slowly stack
up connections and eventually hit the ulimit.
2022-03-24 14:13:06 +01:00
Oliver Gugger 42b0aa9a8e rpcwallet+itest: fix incomplete key info problem
Fixes an issue with SignOutputRaw in remote signing mode where we
weren't able to sign on the remote signer if we only provided the public
key or only the family/index (and not both).

Fixes part of an issue detected in lightninglabs/loop#457.
2022-03-24 14:13:05 +01:00
Oliver Gugger 5bf9b710fc config_builder+rpcwallet: add full net params
As a preparation for parsing addresses, we need the full network
parameters and not just the coin type in the RPC wallet.
2022-03-24 14:13:05 +01:00
Oliver Gugger efa36ce8f2 lntest+lnwallet: add AddressInfo to WalletController
We need to be able to query the watch-only wallet about a public key
when trying to sign with a key that we don't know the family or index
of. The easiest way to do that is to leverage the wallet's address index
to query the derivation path for a public key.
To give the RPC wallet access to that functionality, we need to expose
the method on the WalletController interface.
2022-03-24 14:13:05 +01:00
yyforyongyu 13ade7e9ce htlcswitch+lnwallet: add trace logs for tickers 2022-03-24 10:01:41 +08:00
Bjarne Magnussen 052bb9d711 lnwallet: remove DestAddresses from lnwallet
With `OutputDetail` now containing the destination addresses, the `DestAddresses` field can be removed from the `lnwallet.TransactionDetail`. It is already populated when needed for backwards compatibility to `lnrpc.TransactionDetail` via `OutputDetail.Addresses`.
2022-03-23 11:29:09 +01:00
Bjarne Magnussen d43cdcf9a0 btcwallet: populate data to DestOutput field
Adds the output script and amount to the `DestOutput` field of `TransactionDetails`, as well as sets the flag `isOurAddress` if the output is controlled by the node's wallet.
2022-03-23 11:28:18 +01:00
Bjarne Magnussen cbf6bd9aca lnwallet: add new DestOutputs field to TransactionDetail
A new `DestOutputs` field contains additional information on destinations of a transaction described with the `TransactionDetail` structure.

The additional information inside `DestOuputs` denote the output script and amount, as well as a flag `IsOurAddress` if the address is controlled by the node's wallet.
2022-03-23 11:28:18 +01:00
Olaoluwa Osuntokun e1e9de24df sweep: remove all unconfirmed descendant transactions when a sweep conflicts
Before this commit, we we were trying to sweep an anchor output, and
that output was spent by someone else (not the sweeper), then we would
report this back to the original resolver (allowing it to be cleaned
up), and also remove the set of inputs spent by that transaction from
the set we need to sweep.

However, it's possible that if a user is spending unconfirmed outputs,
then the wallet is holding onto an invalid transaction, as the outputs
that were used as inputs have been double spent elsewhere.

In this commit, we fix this issue by recursively removing all descendant
transactions of our past sweeps that have an intersecting input set as
the spending transaction. In cases where a user spent an unconfirmed
output to funding a channel, and that output was a descendant of the now
swept anchor output, the funds will now properly be marked as available.

Fixes #6241
2022-03-17 16:36:47 -07:00
Oliver Gugger 7dfe4018ce multi: use btcd's btcec/v2 and btcutil modules
This commit was previously split into the following parts to ease
review:
 - 2d746f68: replace imports
 - 4008f0fd: use ecdsa.Signature
 - 849e33d1: remove btcec.S256()
 - b8f6ebbd: use v2 library correctly
 - fa80bca9: bump go modules
2022-03-09 19:02:37 +01:00
yyforyongyu 1ad6bbfbc2 multi: add logs when subservers are starting
Also unified the log messages.
2022-02-11 21:17:03 +08:00
Oliver Gugger 895a2e497b multi: formatting and comment fixes 2022-02-10 11:02:02 +01:00
Oliver Gugger ffee7d1bcf multi: fix newly detected linter issues 2022-02-10 11:02:02 +01:00
Oliver Gugger dfdc2bff8b multi: run gosimports 2022-02-10 11:02:01 +01:00
Oliver Gugger 0bef42e93c Merge pull request #6233 from guggero/sign-psbt-utxo-error-message
rpcwallet: disallow empty UTXO pk script [skip ci]
2022-02-08 09:39:09 +01:00
Olaoluwa Osuntokun 80e304573c lnwallet: increase legacy fee limit threshold to 1k sats
In this commit, we increase the legacy fee limit threshold (the amount
below which we'll allow 100% of funds to go to fees for the non-v2 RPC
calls) from 50 sats to 1k sats.
2022-02-03 11:54:01 -08:00
Oliver Gugger 75016a176c rpcwallet: disallow empty UTXO pk script [skip ci]
If we're signing for an UTXO that isn't known to the wallet, then the
UTXO's pk script _must_ be set in the sign descriptor. Otherwise we run
into a generic PSBT serialization error when running in a remote signing
setup.
2022-02-03 17:34:14 +01:00
Oliver Gugger bfa1cf17b9 lnwallet: introduce default routing fee calculation 2022-02-02 14:24:52 +01:00
Dimitris Apostolou 530a2059e5 multi: Fix typos [skip ci] 2022-01-24 12:19:02 +02:00
Oliver Gugger bab807a57d multi: add migrate-wallet-to-watch-only flag
To enable converting an existing wallet with private key material into a
watch-only wallet on first startup with remote signing enabled, we add a
new flag. Since the conversion is a destructive process, this shouldn't
happen automatically just because remote signing is enabled.
2022-01-06 14:35:26 +01:00
Oliver Gugger afc53d1c52 lnwallet: initialize first 255 accounts
This fixes lightninglabs/loop#437 by adding all accounts that are used
in liquidity products such as Loop or Pool. Since both of these products
use key families below 255, we can get by with that number.
The alternative to creating way too many accounts (which increases the
default wallet size by ~250kB) would be to hard code the exact accounts
used by Loop (99) and Pool (210). But that sounds like a bad idea given
that there could always be more accounts being added to those (or other)
products. By making sure the first 255 accounts exist, we have a lot
more flexibility in those products for choosing key families.
2022-01-06 14:35:26 +01:00
Oliver Gugger da59c1fa62 multi: add health check for remote signer 2022-01-06 14:35:25 +01:00
Oliver Gugger 9601a9ab84 multi: make remote signer RPC timeout configurable 2022-01-06 14:35:25 +01:00
Oliver Gugger f3cd383d1f rpcwallet: add critical log to remote signer errors 2022-01-06 14:35:24 +01:00
Oliver Gugger 3d353a9879 config_builder+rpcwallet: simplify RPC signing
With the remote signing instance now not needing to know anything about
addresses or current derivation indices, we don't need to forward any
such calls to that instance and can simplify the RPCKeyRing
considerably.
2022-01-06 14:35:24 +01:00
Oliver Gugger d135b638f6 btcwallet: add SignPsbt 2022-01-06 13:24:32 +01:00
Oliver Gugger c24763b3da lnd+lnwallet: add logger for btcwallet+rpcwallet 2022-01-06 13:24:32 +01:00
Oliver Gugger b54279dd87 lnwallet: add derivation and prev TX to UTXO 2022-01-06 13:24:31 +01:00
Oliver Gugger 167a1f2b79 btcwallet: add method for deriving key from BIP32 path 2022-01-06 13:24:31 +01:00
Oliver Gugger ca5d5023e3 btcwallet: move PSBT related methods to own file
This is a pure code move commit to extract the FundPsbt and FinalizePsbt
methods into their own file.
2022-01-06 13:24:31 +01:00
Oliver Gugger 8c77829c46 lnwallet+lntest+mod: bump btcwallet to export ScriptForOutput 2022-01-06 13:24:30 +01:00
Oliver Gugger 9da8333a6e multi: fix formatting 2022-01-06 13:24:30 +01:00
yyforyongyu 46050fc631 multi: enhance logging for debugging peer connection 2021-12-23 15:14:37 +08:00
Elle Mouton 2449e66d29 lnwallet+docs: minrelayfee always above fee floor
The minimum relay fee is always ensured to be above our fee floor except
in the very first min relay fee query to bitcoind. This commit ensures
that the fee floor is respected in this first query.
2021-12-13 08:22:34 +02:00
Martin Habovstiak ec24767b9b lnwallet: don't enforce new reserved value in PSBT midstep
This change avoids enforcing new reserved value when PSBT funding is not
finished yet as new inputs and outputs may still be added that could
change the outcome of the check.

This originally failed in the scenario when funding a channel from
external wallet *and depositing to on-chain wallet* was done
simultaneously in a single transaction. If such transaction confirms
then reserved UTXO is guaranteed to be available but the check didn't
take it into account.

The enforcement still occurs in the final step of PSBT funding flow, so
it is safe. It also occurs in case of non-PSBT funding.
2021-12-10 00:22:17 +01:00
yyforyongyu 7e7fca78c4 chainfee: update test TestWebAPIFeeEstimator 2021-12-07 20:18:24 +08:00
yyforyongyu 655ce00220 chainfee: handle conf target not found in cache 2021-12-07 20:18:24 +08:00
Wilmer Paulino 8cfb53f64a lnwallet: support transactions and scripts for new commitment type
This commit modifies the channel state machine to be able to derive the
proper commitment and second-level HTLC output scripts required by the
new script-enforced leased channel commitment type.
2021-10-19 18:30:32 -07:00