Commit Graph

17442 Commits

Author SHA1 Message Date
Jonathan Harvey-Buschel
a0baa8fb41
lnwallet: test aux signer shutdown handling 2024-10-17 17:33:15 +02:00
Jonathan Harvey-Buschel
22deba3d26
lnwallet: refactor test code for HTLC add and recv 2024-10-17 17:33:14 +02:00
Jonathan Harvey-Buschel
b3f953b1c4
multi: allow mock aux signer to customize sig jobs 2024-10-17 17:33:14 +02:00
Oliver Gugger
395a761eb6
Merge pull request #9196 from lightningnetwork/fn-context-guard
fn: add ContextGuard from tapd repo
2024-10-17 17:31:48 +02:00
Oliver Gugger
deefa3a9f1
fn: add ContextGuard from tapd repo
This adds the ContextGuard struct from the taproot-assets repository
that has been in use there for a while.

The context guard allows for easy creation of contexts that depend on a
central wait group and quit channel.

A context can either be created with a timeout and quit, meaning it will
cancel either on reaching the timeout or when the central quit channel
is closed.

Or a context can be created to block and use a timeout, meaning it will
_not_ cancel on quit but rather block the shutdown until it is completed
(or times out).

The third way is to create a context that just cancels on quit with no
timeout.
2024-10-17 13:11:30 +02:00
Oliver Gugger
f46ae2f893
Merge pull request #9195 from yyforyongyu/optimize-itest-setup
itest+lntest: speed up test setup
2024-10-17 10:16:06 +02:00
Oliver Gugger
6992ecc8fc
Merge pull request #9137 from ViktorTigerstrom/2024-09-sync-lock-fix
lnd: allow shutdown signal during `IsSynced` check
2024-10-17 10:04:14 +02:00
yyforyongyu
7849e63e0f
docs: update release doc 2024-10-17 07:45:06 +08:00
yyforyongyu
bf8ae68eea
lntest: add method AssertTxnsNotInMempool
So we only need to do one `GetRawMempool` lookup when checking the
exclusion of multiple txns.
2024-10-17 07:34:40 +08:00
yyforyongyu
e560e00aeb
lntest: remove unused return value 2024-10-17 07:34:25 +08:00
yyforyongyu
ed3cb26188
itest+lntest: stop using pointer to chainhash.Hash
This commit fixes the methods used in `lntest` so they stop using
pointers to chainhash.
2024-10-17 07:14:51 +08:00
Oliver Gugger
af6b88a9f6
Merge pull request #9171 from ellemouton/genUnsignedTLVRanges
tlv: generate types for gossip unsigned range
2024-10-16 16:04:17 +02:00
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