Commit Graph

1325 Commits

Author SHA1 Message Date
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
Wilmer Paulino
01e9bb2bff
lnwallet: coalesce different supported output scripts into single method 2021-10-19 18:30:30 -07:00
Wilmer Paulino
564ec0fd9b
funding+lnwallet: support funding new script enforced leased channels 2021-10-19 18:30:22 -07:00
carla
990dda4b18
multi: thread bandwidth check amount down to MayAddOutgoingHtlc
Pass htlc amount down to the channel so that we don't need to rely
on minHtlc (and pad it when the channel sets a 0 min htlc). Update
test to just check some sane values since we're no longer relying
on minHtlc amount at all.
2021-10-19 09:50:51 +02:00
Oliver Gugger
1541b2ef1b
multi: create and list all default internal accounts 2021-10-14 15:42:56 +02:00
Oliver Gugger
6d339f31c0
rpcwallet: forward FinalizePsbt call over RPC 2021-10-14 15:42:53 +02:00
Oliver Gugger
a3addcc927
multi: forward SendCoins call over RPC 2021-10-14 15:42:52 +02:00
Oliver Gugger
19db382e24
multi: forward address and import calls over RPC
In order to support the full range of on-chain functionality, including
importing watch-only accounts in the watch-only instance, we need to
forward some calls like creating new addresses or importing accounts to
the remote signing instance.
2021-10-14 15:42:51 +02:00
Oliver Gugger
9cae7ad3c2
multi: add remote RPC signing wallet implementation 2021-10-14 15:42:49 +02:00
Oliver Gugger
1309c6afea
multi: allow internal wallet to be watch-only 2021-10-14 15:42:45 +02:00
Oliver Gugger
6093393e2f
multi: refactor SignMessage to specify hashing 2021-10-14 15:42:44 +02:00
Oliver Gugger
e79d59dd4c
multi: use key locator for lnwallet.MessageSigner
To simplify the message signing API even further, we refactor the
lnwallet.MessageSigner interface to use a key locator instead of the
public key to identify which key should be signed with.
2021-10-08 12:06:52 +02:00
Elle Mouton
ad2859c863
chainfee: fetch fresh relay fee for btcd
This commit adds a function to the BtcdEstimator that fetches the
current min relay fee from the btcd node.
2021-10-05 18:30:41 +02:00
Elle Mouton
55077d9404
chainfee: fetch new relay fee from bitcoind
This commit adds a fetchMinMempoolFee function to the BitcoindEstimator
that fetches the current min mempool fee from the bitcoind backend. The
commit then also updates the BitcoindEstimator to use a minFeeManager
for it's minFeeManager member and uses the fetchMinMempoolFee function
to initialise this.
2021-10-05 18:30:41 +02:00
Elle Mouton
c01699853d
chainfee: add minFeeManager
This commit adds a minFeeManager which holds a copy of minFeePerKW
and updates this fee every few calls.
2021-10-05 18:30:41 +02:00
Elle Mouton
f667683e6c
htlcswitch: respect minimum relay fee
When channels fee rates are being considered for an update, the minimum
relay fee should also be considered.
2021-10-05 18:30:41 +02:00
Elle Mouton
6712595618
lnwallet: fix validateFeeRate
The validateFeeRate function uses the availableBalance function to get
the current spendable balance of a channel, adds the old fee and then
ensures that the new fee is not larger than the amount we have available
to spend. This commit also removes the local reserve check in the
validateFeeRate function since the balance returned from
availableBalance already takes the local reserve into acccount.
2021-10-05 09:00:02 +02:00
Elle Mouton
2b8a4d296e
lnwallet: use availableBalance in max fee calc
In this commit we ensure that the max fee calculated in the MaxFeeRate
function takes the local reserve amount into account along with any
pending HTLCs. This is done by calling the avaialbeBalance function.
2021-10-05 08:24:10 +02:00
Oliver Gugger
51d19dad87
Merge pull request #5363 from guggero/psbt-no-final-tx
Allow skipping `PsbtFinalize` step during channel funding to support external broadcast
2021-10-04 12:37:51 +02:00
Oliver Gugger
692ea25295
Merge pull request #5642 from guggero/in-memory-graph
In-memory graph cache for faster pathfinding
2021-10-04 11:20:23 +02:00
Oliver Gugger
1608faf199
multi: allow skipping the PSBT finalize step
The FundingPsbtFinalize step is a safety measure that assures the final
signed funding transaction has the same TXID as was registered during
the funding flow and was used for the commitment transactions.
This step is cumbersome to use if the whole funding process is completed
external to lnd. We allow the finalize step to be skipped for such
cases. The API user/script will need to make sure things are verified
(and possibly cleaned up) properly.
2021-10-04 11:17:08 +02:00
Oliver Gugger
d4136002c1
lnwallet: only set funding TX witness if we publish
During the final part of the channel funding negotiation we only need to
assemble the full funding TX with the witness if we are going to publish
the transaction ourselves. If the final funding TX is published
externally we don't need this information. This will make it possible to
skip the verify process for fully externally funded PSBT channels.
2021-10-04 11:17:08 +02:00
Oliver Gugger
9b04ae45e3
chanfunding: fix swapped godoc comments 2021-10-04 11:17:07 +02:00
Bjarne Magnussen
a5a477e311
lnd: add optional change output index to check reserved wallet balance 2021-10-01 08:21:29 +02:00
Olaoluwa Osuntokun
32fa48df7d
Merge pull request #5770 from Crypt-iQ/dust_threshold_0619
lnwallet+htlcswitch: make Switch dust-aware
2021-09-30 20:20:19 -07:00
eugene
7d16e58b5c
lnwallet: introduce GetDustSum method to calculate worst-case dust sum
It over-estimates the local or remote commitment's dust sum by
counting all updates in both updateLogs that are dust using the
trimmed-to-dust mechanism if applicable. The over-estimation is done
because ensuring an accurate counting is a trade-off between code
simplicity and accuracy.
2021-09-30 13:44:26 -04:00