Commit Graph

1201 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
Oliver Gugger
df1a15f0f1 Merge pull request #10041 from ziggie1984/fix-fwd-pkg-garbage-collection
channeldb: gc fwd packgages which have zero ADDs
2025-07-08 18:30:47 +02:00
ziggie
9a75400295 multi: add logs to debug potential payment sending issue 2025-07-08 10:54:59 +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
ziggie
68b7aaa96f switch: unlock mutex lock earlier
We now unlock the mutex lock of the switch as soon as possible to
avoid potetnial deadlock in the htlc switch.
2025-07-04 13:15:20 +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
George Tsagkarelis
1793b1ab64 routing+htlcswitch: ProduceHtlcExtraData uses first hop pub key 2025-07-02 12:03:34 +02:00
Elle Mouton
8cf567b948 multi: use the "errors" package everywhere
Replace all usages of the "github.com/go-errors/errors" and
"github.com/pkg/errors" packages with the standard lib's "errors"
package. This ensures that error wrapping and `errors.Is` checks will
work as expected.
2025-06-30 09:46:55 +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
e3f95dcd09 htlcswitch: remove batchReplayBkt
This commit removes the `batchReplayBkt` as its only effect is to allow
reforwarding htlcs during startup.

Normally for every incoming htlc added, their shared secret is used as
the key to be saved into the `sharedHashBucket`, which will be used for
check for replays. In addition, the fwdPkg's ID, which is SCID+height is
also saved to the bucket `batchReplayBkt`. Since replays of HTLCs cannot
happen at the same commitment height, when a replay happens,
`batchReplayBkt` simply doesn't have this info, and we again rely on
`sharedHashBucket` to detect it. This means most of the time the
`batchReplayBkt` is a list of SCID+height with empty values.

The `batchReplayBkt` was previously used as a mechanism to check for
reforwardings during startup - when reforwarding htlcs, it quries this
bucket and finds an empty map, knowing this is a forwarding and skips
the check in `sharedHashBucket`. Given now we use a bool flag to
explicitly skip the replay check, this bucket is no longer useful.
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
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
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
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
yyforyongyu
26960e36ce htlcswitch+lntest: add more debug logs 2025-06-06 19:40:35 +08:00
Abdullahi Yunus
f79e6137c1 htlcswitch+channeldb: add htlcidx to fwding log
In this commit we add htlcindex field to the forwardingevent
struct, which is persisted alongside the other event fields.
2025-06-06 12:21:39 +01: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
Oliver Gugger
cf0e0ff32c switch: add trace log for circular route detection
Helps with debugging of strict forwarding issues.
2025-04-17 10:53:37 +02:00
Oliver Gugger
7381f4b221 Merge pull request #9687 from GeorgeTsagk/aux-trff-shpr-htlcview
`AuxTrafficShaper.PaymentBandwidth` uses HTLC view
2025-04-17 07:59:00 +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
ziggie
490347b056 multi: update walletdb package 2025-04-09 18:47:53 +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
Olaoluwa Osuntokun
bf3007a2ce multi: thread thru RPC caller context from CloseChannel 2025-03-18 11:44:20 -05:00