Commit Graph

1144 Commits

Author SHA1 Message Date
yyforyongyu
1d53e7d081
multi: improve loggings 2024-12-20 17:54:03 +08:00
yyforyongyu
944f16255a
htlcswitch: handle nil circuit properly when settling
We have two sources which can call `handlePacketSettle`, either through
the link's `<-s.htlcPlex`, or the `<-s.resolutionMsgs`, which means the
`closeCircuit` could be call twice. Previously we already caught this
case inside `closeCircuit`, in that we would return a nil circuit upon
seeing `ErrUnknownCircuit`, indicating the circuit was removed. However,
we still need to account the case when the circuit is the process of
being closed, which is now fixed as we will ignore when seeing
`ErrCircuitClosing`.
2024-12-16 15:58:23 +08: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
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
Keagan McClelland
127e4fff28
htlcswitch: add logging to quiescer 2024-11-26 14:13:44 -07: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
Keagan McClelland
111c9b05f3
htlcswitch+peer: allow the disabling of quiescence
Here we add a flag where we can disable quiescence. This will be used
in the case where the feature is not negotiated with our peer.
2024-11-26 14:13:39 -07:00
Keagan McClelland
48ee643c0d
htlcswitch: implement noop quiescer
In this commit we implement a noop quiescer that we will use when
the feature hasn't been negotiated. This will make it far easier to
manage quiescence operations without having a number of if statements
in the link logic.
2024-11-26 13:52:54 -07:00
Keagan McClelland
5906ca2537
htlcswitch: add test for deferred processing remote adds when quiescent 2024-11-26 13:52:54 -07:00
Keagan McClelland
4fbab45a5f
htlcswitch: defer processRemoteAdds when quiescent
In this commit we defer processRemoteAdds using a new mechanism on
the quiescer where we capture a closure that needs to be run. We
do this because we need to avoid the scenario where we send back
immediate resolutions to the newly added HTLCs when quiescent as
it is a protocol violation. It is not enough for us to simply defer
sending the messages since the purpose of quiescence itself is to
have well-defined and agreed upon channel state. If, for whatever
reason, the node (or connection) is restarted between when these
hooks are captured and when they are ultimately run, they will
be resolved by the resolveFwdPkgs logic when the link comes back
up.

In a future commit we will explicitly call the quiescer's resume
method when it is OK for htlc traffic to commence.
2024-11-26 13:52:53 -07:00
Keagan McClelland
7255b7357c
htlcswitch: implement InitStfu link operation 2024-11-26 13:51:57 -07:00
Keagan McClelland
70e3804121
htlcswitch: add link operation for initiating quiescence 2024-11-26 13:51:57 -07:00
Keagan McClelland
6d30ab6c4f
htlcswitch: drop connection if link updates after stfu 2024-11-26 13:51:56 -07:00
Keagan McClelland
44c87ef1d7
htlcswitch: bounce packets when quiescent 2024-11-26 13:51:56 -07:00
Keagan McClelland
2ece1fdc54
htlcswitch: implement stfu response
htlcswitch: use quiescer SendOwedStfu method in link stfu implementation
2024-11-26 13:51:56 -07:00
Keagan McClelland
f5b7866287
htlcswitch: define state machine for quiescence
htlcswitch: add sendOwedStfu method to quiescer
2024-11-26 13:51:46 -07:00
Carla Kirk-Cohen
774bfa740a
htlcswitch: relay experimental endorsement signal with update_add_htlc 2024-11-22 09:16:56 -05:00
Elle
4430687076
Merge pull request #9240 from carlaKC/9166-mergeonly
htlcswitch: merge htlc custom records on modify
2024-11-08 08:38:00 +02:00
Olaoluwa Osuntokun
faa4f24806
Merge pull request #9182 from ziggie1984/fix-feebuffer
Deprecate dust-threshold config value
2024-11-07 19:41:38 -08:00
Carla Kirk-Cohen
7896bef2a0
htlcswitch: merge copy htlc custom records 2024-11-07 13:46:54 -05:00
ziggie
20dc7f29f8
multi: fix typo and add comment. 2024-11-07 18:32:45 +01:00
ziggie
7b2da94750
multi: deprecate dust-treshold config value
Replace ambigious config value "dust-treshold" with a more clear
"channel-max-fee-exposure" exposure value. The old value is
deprecated and will be removed in the near future.
2024-11-06 18:16:06 +01:00
ziggie
a040f8fafa
htlcswitch: increase log 2024-11-06 18:12:43 +01:00
ziggie
5fe9bb2cff
htlcswitch: adopt test for dust threshold 2024-10-31 17:35:53 +01:00
ziggie
cfa073e6ec
htlcswitch: increase logs 2024-10-31 17:35:27 +01:00
yyforyongyu
8311bc56e5
htlcswitch: fix flake in TestChannelLinkCancelFullCommitment
We bring down the max number of inflight HTLCs in the link's unit tests
to speed up the tests.
2024-10-31 20:23:31 +08: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
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
cd14c52ecd
htlcswitch: pass quit chans as unidirectional
This is a requirement for replacing the quit channel with a Context.
The Done() channel of a Context is always recv-only, so all users of
that channel must not expect a bidirectional channel.
2024-10-17 17:33:15 +02:00
ffranr
bbae7148aa
multi: pass UpdateAddHtlc message custom records to invoice modifier 2024-09-19 09:21:38 +02:00
ffranr
c58b6a25a2
invoices: integrate settlement interceptor with invoice registry
This commit updates the invoice registry to utilize the settlement
interceptor during the invoice settlement routine. It allows the
interceptor to capture the invoice, providing interception clients an
opportunity to determine the settlement outcome.
2024-09-19 09:21:37 +02:00
Oliver Gugger
cdad5d988d
Merge pull request #9072 from lightningnetwork/extract-part3-from-staging-branch
[custom channels 3/5]: Extract PART3 from mega staging branch
2024-09-19 01:20:55 -06:00
Olaoluwa Osuntokun
13a7becb91
Merge pull request #8044 from ellemouton/g175Messages
[1/7] lnwire: add new Gossip 1.75 messages
2024-09-18 16:05:38 -07:00
Oliver Gugger
52e50d807d
htlcswitch: override amount check on custom records 2024-09-18 19:07:27 +02:00
Olaoluwa Osuntokun
83fdbda2fa
multi: obtain+verify aux sigs for all second level HTLCs
In this commit, we start to use the new AuxSigner to obtain+verify aux sigs for all second level HTLCs. This is similar to the existing SigPool, but we'll only attempt to do this if the AuxSigner is present (won't be for most channels).
2024-09-18 19:04:53 +02:00
Elle Mouton
60f331edb1
multi: rename ChannelUpdate to ChannelUpdate1
In preparation for adding a new ChannelUpdate2 message and a
ChannelUpdate interface, we rename the existing message to
ChannelUpdate1.
2024-09-18 16:13:17 +02:00
xixishidibei
c7505812c5 bug: fix incorrect parameters in test cases
Signed-off-by: xixishidibei <xixishidibei@outlook.com>
2024-09-18 14:58:41 +08:00
Keagan McClelland
dc60f78f7f
htlcswitch: remove PaymentDescriptor conversion from reforwardSettleFails
This is part of a systematic removal of PaymentDescriptor from the mechanics
of the htlcswitch package.
2024-09-09 20:59:41 -06:00
Keagan McClelland
957557a937
htlcswitch+lnwallet: remove PaymentDescriptor from ReceiveRevocation returns
This is part of a systematic removal of PaymentDescriptor from the public
API of the lnwallet package. This marks the last change needed before we
make the PaymentDescriptor structure private.
2024-09-09 20:59:22 -06:00
Keagan McClelland
1ae5705954
htlcswitch: remove PaymentDescriptor from processRemoteSettleFails call signature
This is part of a systematic removal of PaymentDescriptor from the mechanics
of the htlcswitch package.
2024-09-09 17:15:31 -06:00
Keagan McClelland
aa38041240
htlcswitch: remove PaymentDescriptor from processRemoteAdds call signature
This is part of a systematic removal of PaymentDescriptor from the mechanics
of the htlcswitch package.
2024-09-09 17:15:30 -06:00