18470 Commits

Author SHA1 Message Date
yyforyongyu
ea66dacc07
itest: skip force close restart in windows 2025-03-21 08:06:19 +08:00
yyforyongyu
feeb9acaa7
itest: document flakeRaceInBitcoinClientNotifications 2025-03-21 08:06:19 +08:00
yyforyongyu
f0300762c0
lnwallet: move btcwallet log under BTWL
So we can focus on debugging `BTWL` without concerning `lnwallet`, which
has a lot of channel-specific loggings.
2025-03-21 08:06:18 +08:00
yyforyongyu
07f60bd910
lnd: enable logging for sqldb 2025-03-21 08:06:18 +08:00
yyforyongyu
9a25d7172e
sweep: improve loggings 2025-03-21 08:06:18 +08:00
yyforyongyu
533aeb8a25
itest: remove flakeFundExtraUTXO 2025-03-21 08:06:18 +08:00
yyforyongyu
07c60c85f9
lnwallet: remove direct walletdb reference
To make sure the db layer is not exposed and is only managed by the
`btcwallet` package.
2025-03-21 08:06:18 +08:00
yyforyongyu
6e1c098923
gomod: update btcwallet 2025-03-21 08:06:18 +08:00
yyforyongyu
16348e61db
sqldb: add trace logs in ExecuteSQLTransactionWithRetry 2025-03-21 08:06:17 +08:00
Olaoluwa Osuntokun
e8875e06fe
Merge pull request #9602 from lightningnetwork/yy-pending-remote-commit
multi: make sure HTLCs are locked in the itest
2025-03-20 18:11:02 -05:00
yyforyongyu
3b7f9e1975
docs: update release notes 2025-03-21 03:25:24 +08:00
yyforyongyu
652d39dcc7
itest: fix flakeSkipPendingSweepsCheckDarwin
Now that we have the new RPC to assert the HTLC state, this flake should
be fixed.
2025-03-21 03:25:24 +08:00
yyforyongyu
5a72d5258f
htlcswitch+itest: catch link quit signal when processing hodlQueue
This commit makes sure when processing resolutions, e.g, settling
invoices, when the link is already broken, the process would exit with
an error. This fixes the issue we found in the itest, where an
unexpected empty remote pending commitment was created although the
remote peer is already offline.
2025-03-21 03:25:24 +08:00
yyforyongyu
0892b595dd
lnrpc+rpcserver: add new field LockedIn for HTLCs
In this commit, we add a new field `LockedIn` on HTLCs so it can be used
to decide whether an HTLC found on the local commitment has been
committed on the remote commitment.
2025-03-21 03:25:23 +08:00
yyforyongyu
be4c4cc8ff
multi: improve logging 2025-03-21 03:24:26 +08:00
yyforyongyu
66c94cf51f
contractcourt: add String to CommitSet for logging 2025-03-21 03:24:26 +08:00
yyforyongyu
c5f17180bc
netann: remove unused param in newMockGraph 2025-03-21 03:24:26 +08:00
Yong
09b6745086
Merge pull request #9600 from lightningnetwork/yy-more-flakes
lntest+itest: document and fix more flakes
2025-03-21 03:23:02 +08:00
Oliver Gugger
b031002aed
Merge pull request #9604 from jjjike2021/fix-dep
fn: remove x/exp/slices dependency
2025-03-20 11:10:18 -06:00
Olaoluwa Osuntokun
ea050d06f0
Merge pull request #9610 from lightningnetwork/rbf-staging
multi: integrate rbf changes from staging branch
2025-03-19 15:01:23 -05:00
Oliver Gugger
de1ed93f52
Merge pull request #9601 from bitromortac/2503-neutrino-maxpeers
lnd: pass through neutrino MaxPeers config
2025-03-18 16:41:39 -06:00
Olaoluwa Osuntokun
42fa83700a docs/release-notes: update release notes for RBF close 2025-03-18 12:48:01 -05:00
bitromortac
a93ec3b01a
lnd: pass through neutrino MaxPeers config
This enables users to set the config. We check that the currently set
value of MaxPeers is non-zero.
2025-03-18 17:55:20 +01:00
Olaoluwa Osuntokun
3681ba6d8b peer: for RBF state machine block req if RBF iterating is outstanding
This fixes an issue in the itests in the restart case. We'd see an error
like:
```
2025-03-12 23:41:10.754 [ERR] PFSM state_machine.go:661: FSM(rbf_chan_closer(2f20725d9004f7fda7ef280f77dd8d419fd6669bda1a5231dd58d6f6597066e0:0)): Unable to apply event err="invalid state transition: received *chancloser.SendOfferEvent while in ClosingNegotiation(local=LocalOfferSent(proposed_fee=0.00000193 BTC), remote=ClosePending(txid=07229915459cb439bdb8ad4f5bf112dc6f42fca0192ea16a7d6dd05e607b92ae, party=Remote, fee_rate=1 sat/vb))"
```

We resolve this by waiting to send in the new request unil the old one
has been completed.
2025-03-18 11:44:59 -05:00
Olaoluwa Osuntokun
8df58a984c lnwallet/chancloser: add docs for new rbf chan closer 2025-03-18 11:44:59 -05:00
Olaoluwa Osuntokun
720d98cc15 msgmux: fix arg expectation for mock in unit test 2025-03-18 11:44:59 -05:00
Olaoluwa Osuntokun
8d9ed0ca73 docs/release-notes: add rbf coop close section 2025-03-18 11:44:59 -05:00
Olaoluwa Osuntokun
fccd984ac1 multi: extract new DeriveHeightHint() function, use for new rbf closer
With this commit, we make sure we set the right height hint, even if the
channel is a zero conf channel.
2025-03-18 11:44:59 -05:00
Olaoluwa Osuntokun
971ac5a14d itest: add new RBF coop close itest
The itest has both sides try to close multiple times, each time with
increasing fee rates. We also test the reconnection case, bad RBF
updates, and instances where the local party can't actually pay for
fees.
2025-03-18 11:44:57 -05:00
Olaoluwa Osuntokun
3a18bf088c multi: enable RBF co-op bumps after reconnection
In this commit, we alter the existing co-op close flow to enable RBF
bumps after re connection. With the new RBF close flow, it's possible
that after a success round _and_ a re connection, either side wants to do
another fee bump. Typically we route these requests through the switch,
but in this case, the link no longer exists in the switch, so any
requests to fee bump again would find that the link doesn't exist.

In this commit, we implement a work around wherein if we have an RBF
chan closer active, and the link isn't in the switch, then we just route
the request directly to the chan closer via the peer. Once we have the
chan closer, we can use the exact same flow as prior.
2025-03-18 11:44:21 -05:00
Olaoluwa Osuntokun
80b48fb49b peer: update rbf close client logic w/ error and iteration awareness
We'll properly handle a protocol error due to user input by halting, and
sending the error back to the user.

When a user goes to issue a new update, based on which state we're in,
we'll either kick off the shutdown, or attempt a new offer. This matches
the new spec update where we'll only send `Shutdown` once per
connection.
2025-03-18 11:44:21 -05:00
Olaoluwa Osuntokun
fbc67f7610 lntest+itest: extend CloseChannelAssertPending
In this commit, we extend `CloseChannelAssertPending` with new args that
returns the raw close status update (as we have more things we'd like to
assert), and also allows us to pass in a custom fee rate.
2025-03-18 11:44:21 -05:00
Olaoluwa Osuntokun
2899a757c4 lntest: fix error message in WaitForChannelCloseEvent
Resp is always nil, so we actually need to log event.Update here.
2025-03-18 11:44:21 -05:00
Olaoluwa Osuntokun
81d34c4ac2 peer+rpc: set new rbf coop close rbf update fields 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
b32f576aeb lnrpc: add fee rate and local close bool to PendingUpdate
This'll allow us to notify the caller each time a new coop close
transaction with a higher fee rate is signed.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
282c50e444 peer: attempt to unregister endpoint before registering
If we hit an error, we want to wipe the state machine state, which also
includes removing the old endpoint.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
029fbd22fd peer: make activeChanCloses a SyncMap
This fixes some existing race conditions, as the `finalizeChanClosure`
function was being called from outside the main event loop.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
413cc3da35 itest: update async coop close itests to also use new rbf flow 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
429bbf33ef server: thread through new NoRbfCoopClose option
For now, we disallow the option to be used with the taproot chans
option, as the new flow hasn't yet been updated for nonce usage.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
47af913b45 lncfg: add new protocol option - RbfCoopClose 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
a9e538e52d feature: add new NoRbfCoopClose option 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
6364e98f0e peer: conditionally create rbf coop close fsm based on feature bits
In this commit, we fully integrate the new RBF close state machine into
the peer.

For the restart case after shutdown, we can short circuit the existing
logic as the new FSM will handle retransmitting the shutdown message
itself, and doesn't need to delegate that duty to the link.

Unlike the existing state machine, we're able to restart the flow to
sign a coop close with a new higher fee rate. In this case, we can now
send multiple updates to the RPC caller, one for each newly singed coop
close transaction.

To implement the async flush case, we'll launch a new goroutine to wait
until the state machine reaches the `ChannelFlushing` state, then we'll
register the hook. We don't do this at start up, as otherwise the
channel may _already_ be flushed, triggering an invalid state
transition.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
f22cba9de1 peer: conditionally create new RBF chan closer 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
4fff0d8401 peer: create ErrorReporter implementation for rbf-fsm 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
2dae0ba96e peer: add new composite chanCloserFsm type
In this commit, we add a new composite chanCloserFsm type. This'll allow
us to store a single value that might be a negotiator or and rbf-er.

In a follow up commit, we'll use this to conditionally create the new
rbf closer.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
23a9a761e3 peer: add initial awareness of new rbf coop closer
In this commit, we use the interfaces we created in the prior commit to
make a new method capable of spinning up the new rbf coop closer.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
047d3532f9 peer: move existing chan closer init logic to new method
In the next commit, we'll start checking feature bits to decide how to
init the chan closer.

In the future, we can move the current chan closer handling logic into
an `MsgEndpoint`, which'll allow us to get rid of the explicit chan
closer map and direct handling.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
fd05199ff2 protofsm: add an upfront check for SendWhen predicates
In this commit, we add an upfront check for `SendWhen` predicates before
deciding to launch a goroutine. This ensures that when a message comes
along that is already ready to send, we do the send in a synchronous
manner.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
84b6d95b91 lnwallet/chancloser: increase test coverage of state machine 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
7370617aaa lnwallet/chancloser: update RBF state machine to handle early offer case
In this commit, we update the RBF state machine to handle early offer
cases. This can happen if after we send out shutdown (to kick things
off), the remote party sends their offer early. This can also happen if
their outgoing shutdown (to ACK ours) was delayed for w/e reason, and we
get their offer first.

The alternative was to modify the state machine itself, but we feel that
handling this early case is better in line with the Robustness principle.
2025-03-18 11:44:20 -05:00