Commit Graph

17480 Commits

Author SHA1 Message Date
Oliver Gugger
fb5e7f4b23
Merge pull request #9059 from guggero/bitcoind-28
CI: run integration tests against bitcoind v28
2024-10-16 15:55:44 +02:00
Oliver Gugger
f0b1015bae
Merge pull request #9187 from guggero/fix-custom-data
rpcserver+lncli: fix custom channel data encoding issue
2024-10-15 17:31:25 +02:00
Oliver Gugger
8c79940374
cmd/commands: don't error out on replacement failure 2024-10-15 16:40:35 +02:00
Oliver Gugger
5f86e2529b
Merge pull request #9172 from guggero/initwallet-mac-root-key
cmd: allow deterministic macaroon derivation with `lncli`
2024-10-15 12:09:02 +02:00
Oliver Gugger
5d60da54a3
rpcserver: don't write any custom channel data if empty 2024-10-15 09:56:32 +02:00
Oliver Gugger
fcb21dfc24
docs: document deterministic macaroons, add release notes 2024-10-15 09:48:47 +02:00
Oliver Gugger
882f25667e
cmd/commands: add root_key flag to bakemacaroon command 2024-10-15 09:48:46 +02:00
Oliver Gugger
6e932c6bc8
macaroons: add BakeFromRootKey function 2024-10-15 09:48:46 +02:00
Oliver Gugger
fd37c6f90a
cmd/commands: add mac_root_key flag to unlock commands
This commit adds a new --mac_root_key flag to both the lncli create and
lncli createwatchonly commands that allows the user to specify the
macaroon root key that should be used when creating the macaroon
database on wallet initialization.
This allows for deterministic wallet initialization and baking of
macaroons before the wallet is initialized.
2024-10-15 09:48:18 +02:00
Elle Mouton
63d5e92af1
tlv: generate types for gossip unsigned range
For pure TLV messages such as Gossip 1.75 and Bolt12 messages, there are
defined TLV ranges for unsigned data vs signed data. The signed ranges are
the inclusive ranges of 0 to 159 and 1000000000 to 2999999999.
What we do here in this commit is: 1) update the number of main types
generated so that they include type 160 which is the first type in the
un-signed range and we will make use of this type for signature fields
in gossip messages. Next, we add two marker types so that we can define
the rest of the ranges.
2024-10-15 06:21:55 +02:00
ProofOfKeags
7bf9b59816
Merge pull request #9097 from ProofOfKeags/refactor/evaluate-htlc-view
[KILO]: DynComms Prefactor: Refactor/evaluate htlc view
2024-10-14 13:10:00 -06:00
Keagan McClelland
5307e7a5e4
lnwallet: return balance changes rather than modifying references
Here we return the balance deltas from evaluateHTLCView rather than
passing in references to variables that will be modified. It is a
far cleaner and compositional approach which allows readers of this
code to more effectively reason about the code without having to
keep the whole codebase in their head.
2024-10-14 09:40:47 -06:00
Keagan McClelland
f0eecfa2cd
lnwallet: inline and remove process[Add|Remove]Entry
This commit observes that processAddEntry and processRemoveEntry
are only invoked at a single call-site. Here we inline them at their
call-sites, which will unlock further simplifications of the code
that will allow us to remove pointer mutations in favor of explicit
expression oriented programming.

We also delete the tests associated with these functions, the overall
functionality is implicitly tested by the TestEvaluateHTLCView tests.
2024-10-14 09:33:39 -06:00
Keagan McClelland
1222cb8b10
lnwallet: remove continue statements from evaluateHTLCView loops
This further reduces loop complexity in evaluateHTLCView by using
explicit filter steps rather than loop continue statements.
2024-10-14 09:33:39 -06:00
Keagan McClelland
d5aab4a8c1
lnwallet: consolidate loops in evaluateHTLCView
We had four for-loops in evaluateHTLCView that were exact mirror
images of each other. By making use of the new ChannelParty and
Dual facilities introduced in prior commits, we consolidate these
into two for-loops.
2024-10-14 09:33:39 -06:00
Keagan McClelland
51c28496a4
lnwallet: simplify fee calculation in evaluateHTLCView
This commit simplifies how we compute the commitment fee rate based
off of the live updates. Prior to this commit we processed all of
the FeeUpdate paymentDescriptors of both ChannelParty's. Now we only
process the last FeeUpdate of the OpeningParty
2024-10-14 09:33:38 -06:00
Keagan McClelland
4b2a4e36ad
lnwallet: pack htlcView.{OurUpdates|TheirUpdates} into Dual.
This commit moves the collection of updates behind a Dual structure.
This allows us in a later commit to index into it via a ChannelParty
parameter which will simplify the loops in evaluateHTLCView.
2024-10-14 09:33:38 -06:00
Keagan McClelland
1b2cb14254
lnwallet: change bool isIncoming to new lntypes.ChannelParty
This commit removes another raw boolean value and replaces it with
a more clear type/name. This will also assist us when we later try
and consolidate the logic of evaluateHTLCView into a single
coherent computation.
2024-10-14 09:33:38 -06:00
Keagan McClelland
b902d0825d
lnwallet: use fn.Set API directly instead of empty struct map. 2024-10-14 09:33:38 -06:00
Keagan McClelland
d82d02831d
lnwallet: remove mutateState from evaluateHTLCView
In line with previous commits we are progressively removing the
mutateState argument from this call stack for a more principled
software design approach.

NOTE FOR REVIEWERS:
We take a naive approach to updating the tests here and simply
take the functionality we are removing from evaluateHTLCView and
run it directly after the function in the test suite.

It's possible that we should instead remove this from the test
suite altogether but I opted to take a more conservative approach
with respect to reducing the scope of tests. If you have opinions
here, please make them known.
2024-10-14 09:33:16 -06:00
Oliver Gugger
4213ab8947
docs: add release notes 2024-10-14 17:26:59 +02:00
Oliver Gugger
a63542b618
mod: fix unit tests by updating error matching in btcwallet 2024-10-14 17:26:59 +02:00
Oliver Gugger
c156d17da5
lnwallet: turn off RBF detection in test 2024-10-14 17:26:59 +02:00
Oliver Gugger
10802305e5
Merge pull request #8183 from starius/close-tx-in-static-backup
chanbackup, server, rpcserver: put close unsigned tx, remote signature and commit height to SCB
2024-10-14 16:44:19 +02:00
Oliver Gugger
91ade89a78
lntest: avoid port collision on Tor listen port
bitcoind now seems to listen on the -bind port at all times. So we need
to make sure multiple instances don't collide by using a unique port.
2024-10-14 16:10:19 +02:00
Oliver Gugger
56a36acf63
lntest: move debug flag, disable spammy libevent 2024-10-14 16:10:18 +02:00
Oliver Gugger
6ac1ffd274
github+scripts: bump itests to bitcoind v28, allow testing with RCs 2024-10-14 16:10:18 +02:00
Boris Nagaev
65df996358
docs/recovery: add Last resort manual force close
Also updated release-notes.
2024-10-14 09:44:32 -03:00
Boris Nagaev
eda06b19c6
itest: test channel.backup changes upon shutdown 2024-10-14 09:44:32 -03:00
Boris Nagaev
25eecd7a87
lnwallet: fix godoc of TapscriptTweak 2024-10-14 09:44:32 -03:00
Boris Nagaev
3de94c11ae
lntest: fix typo 2024-10-14 09:44:32 -03:00
Boris Nagaev
ef8535356b
itest/lnd_channel_backup_test: fix typos 2024-10-14 09:44:32 -03:00
Boris Nagaev
29946df4e5
server: produces a channel backup upon shutdown
This is needed to keep channel.backup up-to-date if the node is stopped.
2024-10-14 09:44:32 -03:00
Boris Nagaev
fb397c11f1
chanbackup/pubsub: add method ManualUpdate
This method inserts channel updates and waits for them to be processed. It will
be used to update channel.backup upon LND shutdown.
2024-10-14 09:44:32 -03:00
Boris Nagaev
df84148ed2
chanbackup: add Single.CloseTxInputs field
The field is optional. It stores inputs needed to produce signed commit tx using
chantools scbforceclose, which calls function GetSignedCommitTx. New backups
have this field filled if commit tx is available (for all cases except when DLP
is active). If a backup has this data, the field is filled from it, otherwise it
is kept empty.

Modified test function genRandomOpenChannelShell to cover new types of channels
(simple taproot channel and custom channel) and to cover combinations of bits.
Make sure that TapscriptRoot field is properly packed and unpacked.
2024-10-14 09:44:17 -03:00
Boris Nagaev
f485e079b7
chanbackup: add backup version for TapscriptRoot
Previous to this change taproot assets channels and simple taproot channels were
considered the same in the context of chanbackup package, since they stored the
same data. In the following commits we are adding the data needed to produce a
signed commitment transaction from a SCB file and in order to do that we need to
add more fields and a custom channel gets one additional field (TapscriptRoot)
compared to a simple taproot channel. So now we have to distinguish these kinds
of channels in chanbackup package.

See PR https://github.com/lightningnetwork/lnd/pull/8183 for more details.
2024-10-11 10:00:42 -03:00
Boris Nagaev
90c45ddd8f
lnwallet: factor out func GetSignedCommitTx
This pure function creates signed commit transaction, using various
inputs passed as struct TaprootSignedCommitTxInputs and a signer.

This is needed to be able to store the inputs without a signature
in SCB and sign the transaction in chantools scbforceclose.

See https://github.com/lightningnetwork/lnd/pull/8183/files#r1423959791
2024-10-11 10:00:42 -03:00
Boris Nagaev
e7776a4c1e
contractcourt: fix doc of commitSweepResolver
It is used for sweeping time-locked outputs as well as non time-locked outputs.
2024-10-11 10:00:42 -03:00
Boris Nagaev
e04aaa0de0
chanbackup: test encoding of taproot channel 2024-10-11 10:00:42 -03:00
Boris Nagaev
a1aec88268
[lncli] exportchanbackup single channel in hex
It used to be base64, which is not compatible with verifychanbackup,
expecting hex.
2024-10-11 10:00:42 -03:00
Oliver Gugger
136cb42457
Merge pull request #9168 from feelancer21/fix-lncli-wallet-proto
lnrpc: fix lncli documentation tags in walletkit.proto
2024-10-11 06:58:54 -06:00
Keagan McClelland
819239c5c8
lnwallet: inline processUpdateFee and remove the function entirely
In this commit we observe that the previous commit reduced the role
of this function to a single assignment statement with numerous newly
irrelevant parameters. This commit makes the choice of inlining it at
the two call-sites within evaluateHTLCView and removing the funciton
definition entirely. This also allows us to drop a huge portion of
newly irrelevant test code.
2024-10-11 11:25:58 +02:00
Keagan McClelland
05347c8392
lnwallet: bring processFeeUpdate in line with process[Add|Remove]Entry
This commit redoes the API and semantics of processFeeUpdate to make
it consistent with the semantics of it's sister functions. This is
part of an ongoing series of commits to remove mutateState arguments
pervasively from the codebase.

As with the previous commit this makes state mutation the caller's
responsibility. This temporarily increases code duplication at the
call-sites, but this will unlock other refactor opportunities.
2024-10-11 11:25:58 +02:00
Keagan McClelland
49add0f57b
lnwallet: eliminate inner-most layer of evil mutateState nonsense
This commit begins the process of moving towards a more principled
means of state tracking. We eliminate the mutateState argument from
processAddEntry and processRemoveEntry and move the responsibility
of mutating said state to the call-sites.

The current call-sites of these functions still have their *own*
mutateState argument which will be eliminated during upcoming commits.
However, following the principle of micro-commits I opted to break
these changes up to make review simpler.
2024-10-11 11:25:52 +02:00
Keagan McClelland
71da6b5336
lnwallet: consolidate redundant cases using Dual.ForParty 2024-10-11 11:12:36 +02:00
Keagan McClelland
b457b40f80
lnwallet: pack paymentDescriptor add/remove heights into Duals
The purpose of this commit is to begin the process of packing
symmetric fields into the newly introduced Dual structure. The
reason for this is that the Dual structure has a handy indexing
method where we can supply a ChannelParty and get back a value.
This will cut down on the amount of branching code in the main
lines of the codebase logic, making it easier to follow what is
going on.
2024-10-11 11:10:37 +02:00
feelancer21
5290598f1b
lnrpc: fix lncli documentation tags in walletkit.proto
Fixes the tag for `wallet pendingsweeps` and adds the tag for
`wallet estimatefeerate`.
2024-10-08 18:19:36 +02:00
Oliver Gugger
0dd58ee529
Merge pull request #9033 from ziggie1984/non-anchor-channel-bump
error out when non-anchor channels are tried to bump the force close fee.
2024-10-07 23:30:17 -06:00
Olaoluwa Osuntokun
bdc5187749
Merge pull request #9159 from ziggie1984/fn-set-addon
fn: Add Size and IsEmpty methods to Set
2024-10-07 17:30:05 +02:00
Olaoluwa Osuntokun
8e451cb8be
Merge pull request #9144 from ziggie1984/add-rpcclient-logging
lnd: add logger for rpcclient
2024-10-07 11:05:00 +02:00