Commit Graph
100 Commits
Author SHA1 Message Date
Olaoluwa Osuntokun 8dcb7a8f8b docs/release-notes: add release notes entry 2025-08-01 11:20:22 -05:00
Olaoluwa Osuntokun 7e767eac82 discovery: only permit a single gossip backlog goroutine per peer
In this commit, we add a new atomic bool to only permit a single gossip
backlog goroutine per peer. If we get a new reuqest that needs a backlog
while we're still processing the other, then we'll drop that request.
2025-08-01 11:20:22 -05:00
Olaoluwa Osuntokun 5fcd33c50c discovery: add tests for for async timestamp range queue 2025-08-01 11:20:22 -05:00
Olaoluwa Osuntokun ed717a120a docs: add comprehensive gossip rate limiting guide
In this commit, we add detailed documentation to help node operators
understand and configure the gossip rate limiting system effectively.
The new guide addresses a critical knowledge gap that has led to
misconfigured nodes experiencing synchronization failures.

The documentation covers the token bucket algorithm used for rate
limiting, providing clear formulas and examples for calculating
appropriate values based on node size and network position. We include
specific recommendations ranging from 50 KB/s for small nodes to
1 MB/s for large routing nodes, with detailed calculations showing
how these values are derived.

The guide explains the relationship between rate limiting and other
configuration options like num-restricted-slots and the new
filter-concurrency setting. We provide troubleshooting steps for
common issues like slow initial sync and peer disconnections, along
with debug commands and log patterns to identify problems.

Configuration examples are provided for conservative, balanced, and
performance-oriented setups, giving operators concrete starting points
they can adapt to their specific needs. The documentation emphasizes
the importance of not setting rate limits too low, warning that values
below 50 KB/s can cause synchronization to fail entirely.
2025-08-01 11:20:21 -05:00
Olaoluwa Osuntokun 7f16b24192 multi: wire up gossip filter concurrency config
In this commit, we complete the integration of the configurable gossip
filter concurrency by wiring the new FilterConcurrency configuration
through all layers of the application.

The changes connect the gossip.filter-concurrency configuration option
from the command-line interface through the server initialization code
to the gossiper and sync manager. This ensures that operators can
actually use the new configuration option to tune their node's
concurrent gossip filter processing capacity based on their specific
requirements and available resources.
2025-08-01 11:20:21 -05:00
Olaoluwa Osuntokun f3ba372441 discovery: integrate async queue in ProcessRemoteAnnouncement
In this commit, we complete the integration of the asynchronous
timestamp range queue by modifying ProcessRemoteAnnouncement to use
the new queuing mechanism instead of calling ApplyGossipFilter
synchronously.

This change ensures that when a peer sends a GossipTimestampRange
message, it is queued for asynchronous processing rather than
blocking the gossiper's main message processing loop. The modification
prevents the peer's readHandler from blocking on potentially slow
gossip filter operations, maintaining connection stability during
periods of high synchronization activity.

If the queue is full when attempting to enqueue a message, we log
a warning but return success to prevent peer disconnection. This
design choice prioritizes connection stability over guaranteed
delivery of every gossip filter request, which is acceptable since
peers can always resend timestamp range messages if needed.
2025-08-01 11:20:21 -05:00
Olaoluwa Osuntokun 7fb289f24f discovery: add async timestamp range queue to prevent blocking
In this commit, we introduce an asynchronous processing queue for
GossipTimestampRange messages in the GossipSyncer. This change addresses
a critical issue where the gossiper could block indefinitely when
processing timestamp range messages during periods of high load.

Previously, when a peer sent a GossipTimestampRange message, the
gossiper would synchronously call ApplyGossipFilter, which could block
on semaphore acquisition, database queries, and rate limiting. This
synchronous processing created a bottleneck where the entire peer
message processing pipeline would stall, potentially causing timeouts
and disconnections.

The new design adds a timestampRangeQueue channel with a capacity of 1
message and a dedicated goroutine for processing these messages
asynchronously. This follows the established pattern used for other
message types in the syncer. When the queue is full, we drop messages
and log a warning rather than blocking indefinitely, providing graceful
degradation under extreme load conditions.
2025-08-01 11:20:21 -05:00
Olaoluwa Osuntokun 694cc15a73 discovery: make gossip filter semaphore capacity configurable
In this commit, we make the gossip filter semaphore capacity configurable
through a new FilterConcurrency field. This change allows node operators
to tune the number of concurrent gossip filter applications based on
their node's resources and network position.

The previous hard-coded limit of 5 concurrent filter applications could
become a bottleneck when multiple peers attempt to synchronize
simultaneously. By making this value configurable via the new
gossip.filter-concurrency option, operators can increase this limit
for better performance on well-resourced nodes or maintain conservative
values on resource-constrained systems.

We keep the default value at 5 to maintain backward compatibility and
avoid unexpected resource usage increases for existing deployments. The
sample configuration file is updated to document this new option.
2025-08-01 11:20:19 -05:00
Olaoluwa Osuntokun 0eacd07c60 Merge pull request #10107 from ellemouton/fixLogLevelInheritance
go.mod: bump btclog v2 version
2025-07-29 12:29:52 -04:00
Olaoluwa Osuntokun 2e36f9b8b9 Merge pull request #10096 from yyforyongyu/increase-gossip-default
Increase the default outgoing bandwidth
2025-07-25 15:34:01 -05:00
Olaoluwa Osuntokun f09c7aee4e Merge pull request #10095 from guggero/remove-old-keys
scripts/keys: remove old expired or revoked keys
2025-07-21 11:10:43 -05:00
Olaoluwa Osuntokun 47e9f05ddf Merge pull request #10027 from yyforyongyu/dyn-bigsize-msg
Fix `ExtraData` field and use `BigSize` encodine
2025-07-16 10:56:30 -07:00
Olaoluwa Osuntokun 9059a4e7ba Merge pull request #10080 from ellemouton/graphPrefixTables
sqldb+graph/db: prefix graph SQL objects with "graph_"
2025-07-15 15:21:02 -07:00
Olaoluwa Osuntokun 4fef0f4d7a Merge pull request #10001 from yyforyongyu/finalize-stfu
Enable quiescence in production and add timeout config
2025-07-09 19:01:48 -07:00
Olaoluwa Osuntokun fb68f36acb Merge pull request #10048 from ziggie1984/fix-utxonursery-encoding
contractcourt: fix encoding
2025-07-08 16:55:40 -07:00
Olaoluwa Osuntokun d40ac4564b Merge pull request #10044 from ziggie1984/fix-shutdown-issue
Fix Shutdown deadlock in some scenarios
2025-07-08 16:53:30 -07:00
Olaoluwa Osuntokun b3eb9a3cb7 Merge pull request #10028 from ffranr/export-notifier-options
chainntnfs: export NotifierOptions and internal field for interface use
2025-07-03 13:28:08 -07:00
Olaoluwa Osuntokun 7be45c3c42 Merge pull request #10013 from Roasbeef/gemini-review
CI: add config.yaml for gemini code review
2025-07-01 16:52:51 -07:00
Olaoluwa Osuntokun 7af4a18e3a CI: add config.yaml for gemini code review
So far, most of the AI code review tools I've seen in the wild have been
pretty lackluster. I figure we should give the new Gemini Code Assist
variant a try: https://github.com/marketplace/gemini-code-assist/.

This PR adds an initial yaml config for it.

Relevant commands (as comments on the OP PR):
  *  `/gemini review` to perform a code review
  *  `/gemini summary` provides a code summary
  * comment like normal tagging `@gemini-code-assist`
  * `/gemini help`
2025-06-30 16:08:46 -07:00
Olaoluwa Osuntokun 3493b08785 Merge pull request #9978 from ziggie1984/fix-peer-connection
multi: fix deadlock in p2p race condition
2025-06-25 17:36:40 -07:00
Olaoluwa Osuntokun 5f00be2b8c Merge pull request #9148 from ProofOfKeags/lnwire-dyncomms-update
DynComms [2/n]: lnwire: add authenticated wire messages for Dyn*
2025-06-25 17:16:36 -07:00
Olaoluwa Osuntokun 45c15646c6 Merge pull request #9945 from ziggie1984/optional-migration
Decayed log optional migration
2025-06-23 16:17:31 -07:00
Olaoluwa Osuntokun faa68a220e Merge pull request #9880 from yyforyongyu/accessman
Improve access control in peer connections
2025-06-20 15:26:24 -07:00
Olaoluwa Osuntokun 1756f40b36 Merge pull request #9929 from yyforyongyu/fix-decalylog
htlcswitch: remove the bucket `batchReplayBucket`
2025-06-20 14:58:45 -07:00
Olaoluwa Osuntokun 168d63ce37 Merge pull request #9528 from Roasbeef/res-opt
fn: implement ResultOpt type for operations with optional values
2025-06-18 18:22:11 -07:00
Olaoluwa Osuntokun (aider) 0c25bd3f19 fn: implement ResultOpt type for operations with optional values
This commit introduces the ResultOpt type, which represents an operation
that can either succeed with an optional final value or fail with an
error.

The .gitignore file is also updated to exclude specific files related to
the `aider` tool.
2025-06-18 18:16:24 -07:00
Olaoluwa Osuntokun 35102e7c35 Merge pull request #9652 from Roasbeef/rbf-iteration-loop-flake
lnwallet/chancloser: fix flake in TestRbfCloseClosingNegotiationLocal
2025-06-11 14:08:19 -07:00
Olaoluwa Osuntokun da8d2257fd build: bump version to v0.19.99 2025-06-11 12:03:18 -07:00
Olaoluwa Osuntokun c33fbfb3e7 Merge pull request #9928 from ellemouton/removeModReplaces
go.mod: remove tlv and sqldb replace directives
2025-06-11 12:01:08 -07:00
Olaoluwa Osuntokun 07f65b5118 Merge pull request #9923 from ellemouton/graphCache
graph/db: only fetch required info for graph cache population
2025-06-11 10:57:45 -07:00
Olaoluwa Osuntokun eb863e46af lnwallet/chancloser: fix fllake in TestRbfCloseClosingNegotiationLocal/send_offer_rbf_wrong_local_script
In this commit, we fix a flake in the
`TestRbfCloseClosingNegotiationLocal/send_offer_rbf_wrong_local_script`
test.

This flake can happen if the test shuts down _before_ the state machine
is actually able to process the sent event. In this case, the
expectations are triggered, and we find that the error isn't sent.

To resolve this, we create a new wrapper function that'll use a sync
channel send to assert that the error has been sent before we exit the
test.
2025-06-10 18:44:34 -07:00
Olaoluwa Osuntokun 92a5d35cff Merge pull request #9911 from ziggie1984/exit-early-for-fwd-adds
htlcswitch: exit early if no adds are in the fwd pkg
2025-06-10 15:14:09 -07:00
Olaoluwa Osuntokun 32592dbd20 Merge pull request #9897 from ellemouton/inboundFeeTLV
multi: explicitly define InboundFees in ChannelUpdate and ChannelEdgePolicy
2025-06-10 11:05:48 -07:00
Olaoluwa Osuntokun c6d6d4c0b6 Merge pull request #9913 from yyforyongyu/debug-switch
htlcswitch+lntest: add more debug logs
2025-06-06 12:34:40 -07:00
Olaoluwa Osuntokun 89881414e6 Merge pull request #9726 from Roasbeef/protofsm-full-block-conf
protofsm: add option to allow conf resp to return full block
2025-06-03 16:41:22 -07:00
Olaoluwa Osuntokun 3f03752b25 protofsm: add test for new full block conf behavior 2025-06-03 16:39:48 -07:00
Olaoluwa Osuntokun 4908d76653 protofsm: add option to allow conf resp to return full back
In this commit, we add an option to allow a conf req caller to receive
the full block. This is useful if the caller wants to be able to create
an SPV proof.
2025-06-03 16:39:48 -07:00
Olaoluwa Osuntokun a8930773a4 Merge pull request #9725 from Roasbeef/protofsm-conf-mapper
protofsm: add ConfMapper to allow conf attribute projection for new events
2025-06-03 16:28:01 -07:00
Olaoluwa Osuntokun 946ae4c804 protofsm: add generic type assertion to state machine tests
This commit introduces a new generic type assertion function
`assertState` to the state machine tests. This function asserts that the
state machine is currently in the expected state type and returns the
state cast to that type. This allows us to directly access the fields of
the state without having to perform a type assertion manually.
2025-06-03 16:27:30 -07:00
Olaoluwa Osuntokun c580666e28 protofsm: add unit tests for SpendMapper 2025-06-03 16:27:30 -07:00
Olaoluwa Osuntokun cb46f3daa0 protofsm: add new ConfMapper similar to SpendMapper for conf events
In this commit, we add a new ConfMapper which is useful for state
machines that want to project some of the conf attributes into a new
event to be sent post conf.
2025-06-03 16:27:28 -07:00
Olaoluwa Osuntokun f8e67c0bcd Merge pull request #9872 from ziggie1984/fix-peer-connection
brontide: fix peer disconnection issue
2025-06-02 11:53:35 -07:00
Olaoluwa Osuntokun 03b35d000e peer+feature: start to signal the prod rbf coop close bit
In this commit, we start to signal the prod bit for the rbf coop close
feature. We keep our signaling of the staging bit in place to ensure
the protocol continues to work between those nodes in the wild that are
still signaling the bit.

Fixes https://github.com/lightningnetwork/lnd/issues/9852
2025-05-23 13:54:42 -07:00
Olaoluwa Osuntokun 2b76e2fbd5 build: bump version to 0.19.0 2025-05-19 17:46:29 -07:00
Olaoluwa Osuntokun 30f3d7ce89 discovery: lower bandwidth rate limiting log to Debugf 2025-05-19 17:46:08 -07:00
Olaoluwa Osuntokun 5ea7232c31 Merge pull request #9811 from lightningnetwork/0-19-rc-5
build: bump version to v0.19.0-beta.rc5
2025-05-15 14:48:45 -07:00
Olaoluwa Osuntokun 71dbc189d4 Merge pull request #9801 from Roasbeef/pong-relax
peer+lnd: add new CLI option to control if we D/C on slow pongs
2025-05-15 10:25:29 -07:00
Olaoluwa Osuntokun e2c56af519 docs/release-notes: add release notes entry for pong default change 2025-05-15 16:36:38 +02:00
Olaoluwa Osuntokun c493f0c0a9 peer+lnd: add new CLI option to control if we D/C on slow pongs
In this commit, we add a new CLI option to control if we D/C on slow
pongs or not. Due to the existence of head-of-the-line blocking at
various levels of abstraction (app buffer, slow processing, TCP kernel
buffers, etc), if there's a flurry of gossip messages (eg: 1K channel
updates), then even with a reasonable processing latency, a peer may
still not read our ping in time.

To give users another option, we add a flag that allows users to disable
this behavior. The default remains.
2025-05-15 16:36:38 +02:00
Olaoluwa Osuntokun 1a5432368e Merge pull request #9785 from Roasbeef/go-1-23-9
build: bump Go version to v1.23.9
2025-05-07 16:17:00 -07:00
Olaoluwa Osuntokun 1c76c6198c build: bump Go version to v1.23.9 2025-05-06 15:50:16 -07:00
Olaoluwa Osuntokun 850f1edc5f build: bump to version v0.19 rc4 2025-05-05 12:58:35 -07:00
Olaoluwa Osuntokun 7b6c1cf840 Merge pull request #9781 from bitromortac/2505-loadmc
lncli: add loadmc command
2025-05-05 12:00:32 -07:00
Olaoluwa Osuntokun bc4229b32e Merge pull request #9736 from Roasbeef/0-19-0-rc3
build: bump version to v0.19.0 rc3
2025-04-23 15:12:15 -07:00
Olaoluwa Osuntokun c9fe051b2f Merge pull request #9749 from ziggie1984/fix-logging-invoices-payments
mulit: increase logprogress time
2025-04-21 16:40:46 -07:00
Olaoluwa Osuntokun d2f9e97c57 build: bump version to v0.19.0 rc3 2025-04-18 16:18:24 -07:00
Olaoluwa Osuntokun 49faa6f543 build: bump kvdb version 2025-04-18 16:18:23 -07:00
Olaoluwa Osuntokun cb481df816 Merge pull request #9719 from Roasbeef/accessman-log
accessman: add logging to new sub-system
2025-04-18 16:11:11 -07:00
Olaoluwa Osuntokun 9d53617586 Merge pull request #9734 from ziggie1984/improve-logging-for-invoices-payments
Improve logging when fetching invoices and payments
2025-04-18 16:10:45 -07:00
Olaoluwa Osuntokun 825ee3d40b Merge pull request #9723 from ziggie1984/add-global-lock-walletdb
Add the global lock for the wallet db back for postgres
2025-04-18 14:17:44 -07:00
Olaoluwa Osuntokun 21ca1e650b acessman: improve access manager logging and error handling
This commit adds logs to the new access manager. This'll help us monitor
the new system behavior, and may make debugging easier in the future.
2025-04-17 17:20:11 -07:00
Olaoluwa Osuntokun 6517104da6 lnutil: add LogPubKey helper function
This captures a common pattern where we want to log a peer's public key
along side each logging statement.
2025-04-17 17:20:09 -07:00
Olaoluwa Osuntokun a7e89c130d build: bump version to v0.19.0 rc2 2025-04-04 18:43:13 -07:00
Olaoluwa Osuntokun 676414b9d7 build: update to latest versions of sqldb+kvdb 2025-04-04 18:43:09 -07:00
Olaoluwa Osuntokun f0ea5bf3b0 Merge pull request #9672 from Roasbeef/kvdb-sqlite-incremental-vacuum
kvdb/sqlite: enable incremental auto_vacuum on DB creation
2025-04-04 17:57:51 -07:00
Olaoluwa Osuntokun 9eef2a0d6c build: temp replace for sqldb+kvdb 2025-04-04 15:49:29 -07:00
Olaoluwa Osuntokun 9f5bf49ac7 sqldb/sqlite: enable incremental auto_vacuum on DB creation 2025-04-04 15:49:29 -07:00
Olaoluwa Osuntokun a0d6a5591f kvdb/sqlite: enable incremental auto_vacuum on DB creation
In this commit, we make a change that enables the `auto_vacuum =
incremental` pragma for SQLite databases, but only when the database
file is first created. Incremental auto-vacuum allows SQLite to reclaim
unused space within the database file over time, preventing indefinite
growth.
2025-04-04 15:49:29 -07:00
Olaoluwa Osuntokun 580935a4a4 Merge pull request #9669 from Roasbeef/rbf-taproot-downgrade
multi: downgrade to legacy coop close for taproot channels
2025-04-04 14:38:36 -07:00
Olaoluwa Osuntokun 96662ad43a lncfg: mention that taproot chans aren't supported for rbf close 2025-04-04 14:38:12 -07:00
Olaoluwa Osuntokun 1fc2c64770 itest: test all combos of rbf close and taproot chans
In this commit, we test all the combinations of rbf close and taproot
chans. This ensures that the downgrade logic works properly.

Along the way we refactor the tests slightly, and also split them up, as
running all the combos back to back mines more than 50 blocks in a test,
which triggers an error in the itest sanity checks.
2025-04-03 16:23:36 -07:00
Olaoluwa Osuntokun 40f58da161 lnwallet/chancloser: fix flake in TestRbfCloseClosingNegotiationLocal
In this commit, we fix a flake in the rbf loop sub-test for the
TestRbfCloseClosingNegotiationLocal test case.

The fix here is that when we go from ClosePending for an RBF iteration
loop, we first transition to LocalCloseStart. However we only do this
extra transition if we're doing an iteration (starting from ClosePending).

To fix this, we add a new bool that tracks if this is an iteration or
not. We can then also eliminate the extra assertion at the end, as we'll
terminate in `ClosePending` which is checked by
`assertLocalClosePending()` in `assertSingleRbfIteration`.

Fixes https://github.com/lightningnetwork/lnd/issues/9526.
2025-04-01 17:03:24 -07:00
Olaoluwa Osuntokun c5d3d76c33 peer+server: downgrade to legacy coop close for taproot channels
In this commit, we implement logic to downgrade to the legacy coop close
for taproot channels. Before this commit, we wouldn't allow nodes to
start up with both the taproot flag and the rbf flag activated.

In the future, once we implement the spec updates, we'll add support for
this combo, and can revert parts of this commit.
2025-04-01 16:41:26 -07:00
Olaoluwa Osuntokun b01f4e5148 Merge pull request #9657 from bartoli/bartoli-patch-1
Fix release build command
2025-03-31 11:14:17 -07:00
Olaoluwa Osuntokun f08e7fe0d6 lnwallet/chancloser: fix flake in TestRbfChannelFlushingTransitions/early_offer
In this commit, we fix a flake in the
`TestRbfChannelFlushingTransitions/early_offer` test. The fix is simple:
this is actually an "iteration", as we have a self transition to the
ChannelNegotiation state first. We also don't need to send the
remoteOffer, so we set `sendInit` to false. The offer still needs to be
passed in to ensure that the assertions work however.
2025-03-26 16:36:13 -07:00
Olaoluwa Osuntokun a307280c40 protofsm: reduce log spam during state transitions
In this commit, we reduce log spam a bit during state transitions. We
only log the type of the event when sending the event, as we'll print
the same event when creating the queue "applying", and later when
processing". Next we remove the "applying" log as that first event will
always be logged twice.

The combo of these to changes makes the logs much easier to follow.
2025-03-26 16:36:11 -07:00
Olaoluwa Osuntokun 0053fda6da Merge pull request #9624 from Roasbeef/0-19-branch
build: bump version to v0.19 rc1
2025-03-24 19:24:26 -07:00
Olaoluwa Osuntokun 1cebfedbae Merge pull request #9607 from Roasbeef/unified-gossip-limiter
discovery: unify rate.Limiter across all gossip peers
2025-03-24 19:22:16 -07:00
Olaoluwa Osuntokun 8c3c53f63b docs/release-notes: add release notes for gossip rate limit 2025-03-24 19:21:46 -07:00
Olaoluwa Osuntokun c7ed5d65c6 multi: add new config options to tune gossip msg allocated bandwidth
We go with the defaults of if no values are set.
2025-03-24 19:21:45 -07:00
Olaoluwa Osuntokun 05702d48b2 discovery: switch to bytes based rate limiting for outbound msgs
In this commit, we revamp the old message based rate limiting. First, we
move to meter by bytes/s instead of messages/s. The old logic had an
error in that it limited groups of message replies, instead of each
message. With this new approach, we'll use the newly added
SerializedSize method to implement fine grained bandwidth metering.

We need to pick two values, the burst rate, and the msg bytes rate. The
burst rate is the max amt that can be sent in a given period of time. We
need to set this above 65 KB, or the max msg limit, otherwise no
messages can be sent. The bucket starts with this many tokens (bytes).
As those are depleted, the amount of tokens is refilled at the msg
bytes rate.

As conservative values, we've chosen 200 KB as the burst rate, and 100
KB/s as the limit.
2025-03-24 19:21:45 -07:00
Olaoluwa Osuntokun 5b93319aaa build: bump version to v0.19 rc1 2025-03-24 15:49:23 -07:00
Olaoluwa Osuntokun 66077b1722 chainio: demote per-block logging to Debugf 2025-03-24 15:49:21 -07:00
Olaoluwa Osuntokun 67d2eac437 Merge pull request #9620 from guggero/testnet4
chain: add testnet4 support
2025-03-24 15:48:26 -07:00
Olaoluwa Osuntokun 5235f3b24f Merge pull request #9623 from Roasbeef/size-msg-test-msg
Size msg test msg
2025-03-21 12:18:36 -07:00
Olaoluwa Osuntokun 05a6b6838f lnwire: add new TestSerializedSize method
This uses all the interfaces and implementations added in the prior test.
2025-03-20 18:28:53 -07:00
Olaoluwa Osuntokun b2f24789dc lnwire: revamp TestLightningWireProtocol using new rapid test gen
With what we added in the prior commit, we can significantly shrink the
size of this test. We also make it easier to extend in the future, as
this will fail if a new message is added, that doesn't have the needed
methods, as long as MsgEnd is updated.
2025-03-20 18:28:23 -07:00
Olaoluwa Osuntokun eb877db2ff lnwire: add new TestMessage interface for property tests
In this commit, we add a new `TestMessage` interface for use in property
tests. With this, we'll be able to generate a random instance of a given
message, using the rapid byte stream. This can also eventually be useful
for fuzzing.
2025-03-20 18:28:07 -07:00
Olaoluwa Osuntokun 56a100123b lnwire: add new SerializedSize method to all wire messages
This'll be useful for the bandwidth based rate limiting we'll implement
in the next commit.
2025-03-20 18:27:52 -07: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
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
Olaoluwa Osuntokun 42fa83700a docs/release-notes: update release notes for RBF close 2025-03-18 12:48:01 -05: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