Commit Graph

1810 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
b94ce6fa08
lnwallet: use custom LockTime for rbf coop close 2024-12-10 23:07:02 +01:00
Olaoluwa Osuntokun
ab4297e127
lnwallet/chancloser: use block height as lock time for rbf-coop 2024-12-10 23:07:02 +01:00
Olaoluwa Osuntokun
540d3c0fc7
multi: switch to lock time from sequence for coop close v2 2024-12-10 23:07:01 +01:00
Olaoluwa Osuntokun
2decea86d8
lnwallet/chancloser: add unit tests for new rbf coop close 2024-12-10 23:07:01 +01:00
Olaoluwa Osuntokun
6b90254fd3
lnwallet/chancloser: create a MsgMapper for the protofsm rbf close
This'll allow us to treat the state machine as a MsgEndpoint, and have
the readHandler in the peer automatically send new messages to it.
2024-12-10 23:07:01 +01:00
Olaoluwa Osuntokun
e47a632745
lnwallet/chancloser: add state transitions for new protofsm rbf closer
In this commit, we add the state transitions for the new protofsm based
RBF chan closer. The underlying protocol is a new asymmetric co-op close
process, wherein either side can initiate a chan closer, and use their
settled funds to pay for fees within the channel.
2024-12-10 23:07:01 +01:00
Olaoluwa Osuntokun
f6525c9e7d
lnwallet: add ability to specify custom sequence for co-op close tx
In this commit, we add the ability to specify a custom sequence for a
co-op close tx. This'll come in handy later as the new co-op close
process allows a party to set a custom sequence.
2024-12-10 23:07:01 +01:00
Olaoluwa Osuntokun
62a3db1cc2
lnwallet/chancloser: add states for new protofsm rbf closer
In this commit, we add the initial set of states for the new protofsm
based rbf chan closer. A diagram outlining the new states and their
transitions can be found here:
https://gist.github.com/Roasbeef/acc4ff51b9dff127230228a05553cdfe.

Unlike the existing co-op close process, this co-op close can be
restarted at anytime if either side sends a shutdown message. From
there, we'll each obtain a new RBF'd version that can be re-broadcasted.

This commit creates the set of states, along with the environment that
our state machine will use to drive itself forward.
2024-12-10 23:07:01 +01:00
Keagan McClelland
ed2989ae33
multi: update to fn v2 2024-12-04 13:19:00 -07:00
Elle Mouton
ab7aae0708
multi: rename nolint:lll to nolint:ll
Find and replace all nolint instances refering to the `lll` linter and
replace with `ll` which is the name of our custom version of the `lll`
linter which can be used to ignore log lines during linting.

The next commit will do the configuration of the custom linter and
disable the default one.
2024-12-02 09:14:21 +02:00
Elle Mouton
439a6c7d6c
multi: rename chan DB Open method to OpenForTesting 2024-11-28 13:51:15 +02:00
Elle Mouton
9f54ec90aa
multi+refactor: move models package to graph/db
All the structs defined in the `channeldb/models` package are graph
related. So once we move all the graph CRUD code to the graph package,
it makes sense to have the schema structs there too. So this just moves
the `models` package over to `graph/db/models`.
2024-11-28 13:34:33 +02:00
Elle Mouton
c2923e2214
multi: remove PrefixLog
And instead use the new btclog Logger `WithPrefix` method.
2024-11-27 10:44:32 +02:00
Oliver Gugger
94f7ed46de
Merge pull request #8998 from Abdulkbk/trx-pagination
pagination: add pagination to wallet transactions
2024-11-22 09:30:11 +01:00
Abdullahi Yunus
6ee8d2c9b9 lnwallettest: test for tranasctions pagination
In this commit, we test for different values of index_offset and
max_transactions settings when getting transactions to make sure
the right number of transactions are returned along with the right
first and last indices.
2024-11-22 08:23:58 +01:00
Abdullahi Yunus
762d01536b multi: return txns first and last indices
In this commit we introduce first and last indices for the
tranasctions returned which can be used to seek for further
transactions in a pagination style.

Signed-off-by: Abdullahi Yunus <abdoollahikbk@gmail.com>
2024-11-22 08:22:55 +01:00
Abdullahi Yunus
cd1df4ac34 multi: modify listtxn definition
This commit modifies listtransactiondetails method definition to
take in additional params: index_offset and maxTxn
2024-11-22 08:21:27 +01:00
yyforyongyu
b243394049
lnwallet: log the amounts in the same unit 2024-11-21 20:42:47 +08:00
ziggie
5486f32444
multi: introduce an option for resolutions
We don't always need the resolutions in the local force close
summary so we make it an option.
2024-11-20 09:18:24 +01:00
Olaoluwa Osuntokun
87b4991bb6
lnwallet: add whoseCommit to FetchLeavesFromCommit
This is useful for additional context to know which commit the
AuxLeafStore is fetching the leaves for.
2024-11-14 16:09:58 -08:00
Olaoluwa Osuntokun
af60fa0c3a
lnwallet: populate resolution blob for incoming+outgoing HTLC resolutions
In this commit, we populate the resolution blobs for the incoming and
outgoing HTLCs. We take care to populate the AuxSigDesc with the correct
information, as we need to pass along the second-level aux signature and
also sign desc along with it.
2024-11-14 16:09:57 -08:00
Olaoluwa Osuntokun
08d0aa2368
channel: add ResolutionBlob to Incoming+Outgoing HtlcResolution
Similar to the other blobs we have for the commitment output force close
resolution, these blobs will be used to ensure that we have everything
needed to sweep aux HTLCs.
2024-11-14 16:09:57 -08:00
Olaoluwa Osuntokun
98b41c6576
channel: always specify ChanType in ResolutionReq 2024-11-14 16:09:57 -08:00
Olaoluwa Osuntokun
bf350c6ede
lnwallet: expand attributes in ResolutionReq
In this commit, we add some additional attributes to the ResolutionReq
struct. These will be used to make sure that we can properly handle all
the HTLC variants, on chain.

The `AuxSigDesc` will be used to communicate if an HTLC needs to go to
the second level or not. It contains the second-level sig information
needed to finalize a broadcast to the second level.
2024-11-14 16:09:57 -08:00
yyforyongyu
523ecc0653
multi: wait for rpcclients shutdown to complete
We need to call `WaitForShutdown` after stopping the rpc clients of the
chain backends.
2024-11-14 01:22:31 +08:00
George Tsagkarelis
55c3da3d13
lnwallet+lnrpc: use maxFeeRatio across coin selection tests 2024-11-05 19:56:37 +01:00
George Tsagkarelis
a72dae314c
lnwallet: use new maxFeeRatio for sanityCheckFee func 2024-11-05 19:55:07 +01:00
Oliver Gugger
22c3cc51ed
Merge pull request #9223 from starius/close-to-external-p2tr
lnwallet: fix closechannel for P2TR external addr
2024-10-30 14:10:21 +01:00
myxmaster
7b5b92ff02 chanfunding: improve sanityCheckFee error message for clarity and update coin_select_test accordingly 2024-10-28 20:04:34 +01:00
Boris Nagaev
9fec11eeb5
lnwallet: fix closechannel for P2TR external addr
If the delivery address is P2TR, function InternalKeyForAddr checks its
existance in the wallet to return internal key for it in case it is a custom
taproot channel. It used to return the error returned by wallet.AddressInfo.
The error is now ignored if it is ErrAddressNotFound error. This fixes
"lncli closechannel --delivery_addr <external p2tr address" case.
2024-10-28 11:08:15 -03:00
Elle Mouton
9d0cd3ff4f
multi: update more loggers to the v2 type 2024-10-22 17:03:56 +02:00
Elle Mouton
23602e017e
multi: start updating various loggers to use the new v2 type 2024-10-22 17:03:55 +02:00
Jonathan Harvey-Buschel
dce80ac9a1
lnwallet: test link quit signal handling 2024-10-17 17:35:29 +02:00
Jonathan Harvey-Buschel
77ae7afe78
multi: link quit can interrupt commitment signing
In this commit, we make sig job handling when singing a next commitment
non-blocking by allowing the shutdown of a channel link to prevent
further waiting on sig jobs by the channel state machine. This addresses
possible cases where the aux signer may be shut down via a separate quit
signal, so the state machine could block indefinitely on receiving an
update on a sig job.
2024-10-17 17:35:29 +02:00
Jonathan Harvey-Buschel
48567e8944
lnwallet: sort sig jobs before submission 2024-10-17 17:33:15 +02:00
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
fb5e7f4b23
Merge pull request #9059 from guggero/bitcoind-28
CI: run integration tests against bitcoind v28
2024-10-16 15:55:44 +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
c156d17da5
lnwallet: turn off RBF detection in test 2024-10-14 17:26:59 +02:00