Commit Graph

498 Commits

Author SHA1 Message Date
ziggie
e2a9b17254 multi: skip range check in pathfinder and switch for custom htlc payments 2025-08-06 09:37:08 +02: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
Oliver Gugger
47dce08948 Merge pull request #10018 from yyforyongyu/minor-refactor-link
Refactor link's long methods
2025-07-08 19:51:04 +02:00
ziggie
923cafb989 multi: revert back changes from 9911
always process remote ADDs even when they are empty to trigger
the gc process when loading them back into memory.
2025-07-08 10:25:26 +02:00
yyforyongyu
127b0e9f41 multi: add new config QuiescenceTimeout
This commit makes removes the `defaultQuiescenceTimeout` and makes it
configurable as different nodes have different network environment. In
addition the default timeout has been increased from 30s to 60s.
2025-07-04 04:19:59 +08:00
yyforyongyu
240593a399 htlcswitch: log the error returned from SendMessage 2025-07-03 19:51:35 +08:00
yyforyongyu
d9369ae1a8 htlcswitch: remove unnecessary prand.Seed 2025-07-03 19:51:35 +08:00
yyforyongyu
1b6ca8827e htlcswitch: fix linters
Fix a few linter errors - these were not caught before as they were
configured to be ignored.
2025-07-03 19:51:33 +08:00
yyforyongyu
2bb8b90afd htlcswitch: fix error not checked
As required by the linter.
2025-07-03 19:50:58 +08:00
yyforyongyu
31e166a6b3 htlcswitch: add processLocalUpdateFaillHTLC 2025-07-03 19:50:30 +08:00
yyforyongyu
765714e750 htlcswitch: add processLocalUpdateFulfillHTLC 2025-07-03 19:50:29 +08:00
yyforyongyu
c42bf9b545 htlcswitch: log err in the end in handleUpstreamMsg 2025-07-03 19:50:29 +08:00
yyforyongyu
87b490dfc4 htlcswitch: add processRemoteError and processRemoteUpdateFee 2025-07-03 19:50:29 +08:00
yyforyongyu
4017104475 htlcswitch: add processRemoteRevokeAndAck 2025-07-03 19:50:29 +08:00
yyforyongyu
04abf96f60 htlcswitch: add processRemoteCommitSig 2025-07-03 19:50:29 +08:00
yyforyongyu
ad1566ee3f htlcswitch: add processRemoteUpdateFailHTLC 2025-07-03 19:50:29 +08:00
yyforyongyu
e883a51a63 htlcswitch: add processRemoteUpdateFailMalformedHTLC 2025-07-03 19:50:28 +08:00
yyforyongyu
f9df5a9f51 htlcswitch: add processRemoteUpdateFulfillHTLC 2025-07-03 19:50:28 +08:00
yyforyongyu
212262bf88 htlcswitch: add processRemoteUpdateAddHTLC 2025-07-03 19:50:28 +08:00
yyforyongyu
83f658f714 htlcswitch: remove TODO and nolint
This old TODO is no longer relevant.
2025-07-03 19:50:28 +08:00
yyforyongyu
3af8281370 htlcswitch: add handler resumeLink 2025-07-03 19:50:25 +08:00
yyforyongyu
ca770bb4af htlcswitch: notify channel active after reforwarding
The channel should only be considered active when its pending tasks are
finished, which includes,
1. sync channel state via reestablish.
2. send previous shutdown msg.
3. reset the mailbox's packets.
4. reforwarding logs loaded from restart.

When the above tasks are finished, the channel can be considered as
fully resumed from its previous disconnection.
2025-07-03 18:31:13 +08:00
yyforyongyu
09022b5f56 htlcswitch: add handler toggleBatchTicker 2025-07-03 18:31:12 +08:00
yyforyongyu
cccb447439 htlcswitch: add handler handleUpdateFee 2025-07-03 18:31:12 +08:00
yyforyongyu
e8b2035484 htlcswitch: add handler handleQuiescenceReq 2025-07-03 18:31:12 +08:00
yyforyongyu
30f9257a6b htlcswitch: add handler handleHtlcResolution 2025-07-03 18:31:12 +08:00
George Tsagkarelis
4ad84627e1 htlcswitch+routing: PaymentBandwidth accepts channel peer pubkey argument 2025-07-02 12:09:24 +02:00
yyforyongyu
755bb09a73 htlcswitch: skip decoding hop if the htlc is already acked
We now move the check earlier in the loop so we don't even need to
decode the hop for already processed ADDs.
2025-06-17 11:39:38 +08:00
yyforyongyu
3b9c4eb232 htlcswitch: exit early if the fwdPkg is already completed 2025-06-17 11:39:38 +08:00
yyforyongyu
fb95458a1b htlcswitch: skip checking replays for reforwarded packets
We now rely on the forwarding package's state to decide whether a given
packet is a reforwarding or not. If we know it's a reforwarding packet,
there's no need to check for replays in the `sharedHashes` bucket, which
behaves the same as if we are querying the `batchReplayBkt`.
2025-06-17 11:39:37 +08:00
ziggie
6feed32288 htlcswitch: exit early if no adds are in the fwd pkg
This lead to the case that we would always record a HTLC
two times in the decayed log protection which is not necessary
in the first place.
2025-06-09 09:17:25 +02:00
Oliver Gugger
56d2381f51 htlcswitch+routing: add funding blob to PaymentBandwidth
For certain auxiliary bandwidth checks we need to know the funding blob
that was present when the channel was created.
2025-04-22 21:21:11 +02:00
Oliver Gugger
5fb0f43172 htlcswitch+routing: add htlc blob to ShouldHandleTraffic
Whether we should let the aux bandwidth manager decide what the
bandwidth of a channel is should also depend on whether the HTLC is a
custom HTLC, not just the channel.
2025-04-17 11:52:56 +02:00
George Tsagkarelis
d0ef248ae2 htlcswitch: add HtlcView as PaymentBandwidth argument
In order to get more precise bandwidth reports, we also need to provide
this method with the latest htlc view. Since aux data is committed to in
the channel commitment, some uncommited HTLCs may not be accounted for,
so we need to manually provide them via the HTLC view.
2025-04-14 15:42:28 +02: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
be4c4cc8ff multi: improve logging 2025-03-21 03:24:26 +08:00
Oliver Gugger
dac5de5ce9 htlcswitch+routing: return IsHandled from AuxBandwidth
To make it more clear whether the external traffic shaper is handling a
channel or not, we return an explicit boolean.
2025-03-13 12:26:50 -05:00
ziggie
9382fcb801 multi: fix debug log 2025-02-20 10:44:19 +01:00
ziggie
17e37bd7c2 multi: introduce new traffic shaper method.
We introduce a new specific fail resolution error when the
external HTLC interceptor denies the incoming HTLC. Moreover
we introduce a new traffic shaper method which moves the
implementation of asset HTLC to the external layers.
Moreover itests are adopted to reflect this new change.
2025-01-29 09:59:02 +01:00
Elle Mouton
950194a2da htlcswitch+go.mod: use updated fn.ContextGuard
This commit updates the fn dep to the version containing the updates to
the ContextGuard implementation. Only the htlcswitch/link uses the guard
at the moment so this is updated to make use of the new implementation.
2025-01-11 06:17:43 +02:00
Olaoluwa Osuntokun
fb429d658b Merge pull request #9330 from ProofOfKeags/update/fn2
multi: update to fn v2
2024-12-09 12:56:23 +01:00
Oliver Gugger
86b3be71fe multi: thread through and use AuxTrafficShaper 2024-12-05 12:39:34 +01:00
Oliver Gugger
a2e78c3984 htlcswitch: thread through packet's inbound wire records
For calculating the available auxiliary bandwidth of a channel, we need
access to the inbound custom wire records of the HTLC packet, which
might contain auxiliary information about the worth of the HTLC packet
apart from the BTC value being transported.
2024-12-05 12:39:33 +01:00
Oliver Gugger
117c6bc781 multi: move routing.TlvTrafficShaper => htlcswitch.AuxTrafficShaper
With this commit we move the traffic shaper definition from the routing
package to the HTLC switch package as a preparation for being able to
use it there as well.
At the same time we rename it to AuxTrafficShaper to be more in line
with the other auxiliary components.
2024-12-05 12:39:33 +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
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
Keagan McClelland
ac0c24aa7b htlcswitch: don't pass pending update counts into quiescer
This change simplifies some of the quiescer responsibilities in
favor of making the link check whether or not it has a clean state
to be able to send or receive an stfu. This change was made on the
basis that the only use the quiescer makes of this information is
to assess that it is or is not zero. Further the difficulty of
checking this condition in the link is barely more burdensome than
selecting the proper information to pass to the quiescer anyway.
2024-11-26 14:13:43 -07:00
Keagan McClelland
a4c49a88f1 htlcswitch: add quiescence timeout that is aborted by Resume 2024-11-26 14:13:43 -07:00