Commit Graph

1106 Commits

Author SHA1 Message Date
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
Keagan McClelland
d881809a4d
htlcswitch: remove PaymentDescriptor from hodlHtlc
This is part of a systematic removal of PaymentDescriptor from the
mechanics of the htlcswitch package.
2024-09-09 16:53:11 -06:00
Keagan McClelland
a0818a0d16
htlcswitch: remove PaymentDescriptor from the processExitHop's call signature
This is part of a systematic removal of PaymentDescriptor from the mechanics
of the htlcswitch package.
2024-09-09 16:53:10 -06:00
Keagan McClelland
07647fe53a
htlcswitch: remove PaymentDescriptor from settleHTLC's call signature
This is done as part of a systematic removal of PaymentDescriptor from
the mechanics of the htlcswitch package.
2024-09-09 16:53:10 -06:00
Keagan McClelland
877d29c717
htlcswitch: remove PaymentDescriptor from sendHTLCError's call signature
This is done as part of a systematic removal of PaymentDescriptor from
the mechanics of the htlcswitch package.
2024-09-09 16:53:10 -06:00
Keagan McClelland
721a0c5edc
lnwire+htlcswitch: change NewInvalidBlinding to use array instead of slice 2024-09-09 16:26:41 -06:00
Keagan McClelland
5505b6daff
htlcswitch: change sendMalformedHTLCError to take array instead of slice 2024-09-09 16:26:41 -06:00
Keagan McClelland
5deb4c253a
htlcswitch+lnwallet: fix OnionBlob to 1366 bytes 2024-09-09 16:26:41 -06:00
George Tsagkarelis
5dcda25881
htlcswitch: expose custom channel blob from link 2024-09-05 18:00:49 +02:00
George Tsagkarelis
878f964a33
multi: use wire records on payment and intercept flows 2024-09-05 11:18:16 +02:00
ffranr
fb14d8c96e
routerrpc: extend HTLC forward interceptor resp with modification fields
This commit extends the forward HTLC intercept response with fields that
can be used in conjunction with a `ResumeModified` action to modify the
intercepted HTLC p2p message.
2024-09-05 11:18:15 +02:00
ffranr
abca4b8234
htlcswitch: add resume modified HTLC action to switch
Introduce `ResumeModified` action to resume standard behavior of a p2p
message with optional modifications as specified by the client during
interception.
2024-09-05 11:18:15 +02:00
ffranr
8d1059f41c
lnwire: add custom records field to type UpdateFulfillHtlc
- Introduce the field `CustomRecords` to the type `UpdateFulfillHtlc`.
- Encode and decode the new field into the `ExtraData` field of the
`update_fulfill_htlc` wire message.
- Empty `ExtraData` field is set to `nil`.
2024-09-05 11:18:15 +02:00
George Tsagkarelis
ea92d0aecc
multi: refresh htlcswitch aliases on aliasmgr update 2024-09-05 08:44:32 +02:00
Keagan McClelland
1422729f80
lnwallet+htlcswitch: define expanded NumPendingUpdates
This commit squashes the below operations for a net result where
we have an expanded capability of assessing pending updates. This
is made possible by packing the components into Duals in the prior
commits. We squash the operations to simplify review.

htlcswitch+lnwallet: rename PendingLocalUpdateCount

lnwallet: complete pending update queries API for LightningChannel

lnwallet+htlcswitch: consolidate NumPendingUpdates using ChannelParty

This commit makes the observation that we can cleanly define the
NumPendingUpdates function using a single expression by taking
advantage of the relevant fields being properly packed into Duals.
2024-08-28 14:03:00 -07:00
Keagan McClelland
a0515a16db
htlcswitch: extract error handling for syncChanStates 2024-08-28 13:46:52 -07:00
Eugene Siegel
99b86ba462
multi: extend lnpeer.Peer interface with Disconnect function
This will be used in the gossiper to disconnect from peers if their
ban score passes the ban threshold.
2024-08-27 14:11:06 -04:00
ffranr
1297e8f7c7
htlcswitch: add missing method doc 2024-08-22 18:33:24 +02:00
ffranr
7df093b3b1
multi: improve comment grammar 2024-08-22 18:33:24 +02:00
Oliver Gugger
e99e6662cf
multi: update linter, fix new issues 2024-08-20 19:14:44 +02:00
yyforyongyu
7aba5cbc0a
routing: fix linter complains 2024-08-07 22:19:23 +08:00
yyforyongyu
b998ce11f1
routing+htlcswitch: add new interface method HasAttemptResult 2024-08-07 22:18:51 +08:00
yyforyongyu
3b6e28d19b
channeldb+htlcswitch: make sure circuit is not nil in teardownCircuit 2024-08-07 22:17:59 +08:00
yyforyongyu
2fc79d8946
htlcswitch: handle forwarding settle and fail seperately
This commit adds two methods, `handlePacketFail` and
`handlePacketSettle` to handle the settle and fail packets differently.
2024-08-07 22:17:59 +08:00
yyforyongyu
6cb374aea6
htlcswitch: add new method handlePacketAdd
Simply moves the code into a new method so it's easier to follow the
method `handlePacketForward`.
2024-08-07 22:17:59 +08:00
yyforyongyu
21112cfdf8
htlcswitch: rename paymentID to attemptID for clarity 2024-08-07 22:17:58 +08:00
Oliver Gugger
11c7e20d0a
Merge pull request #8953 from ProofOfKeags/refactor/lnwallet-channel-channel-constraints-partition
[MICRO]: multi: break ChannelConstraints into two sub-structures
2024-08-05 02:08:52 -06:00
Olaoluwa Osuntokun
4a3c4e4ba7
Merge pull request #8497 from ziggie1984/shutdown-bugfix
routing: shutdown chanrouter correctly.
2024-08-01 16:48:50 -07:00
Keagan McClelland
e3a9d0acbe
multi: break ChannelConstraints into two sub-structures
This commit breaks the ChannelConstraints structure into two
sub-structures that reflect the fundamental differences in how
these parameters are used. On its face it may not seem necessary,
however the distinction introduced here is relevant for how we
will be implementing the Dynamic Commitments proposal.
2024-08-01 12:00:32 -07:00
Keagan McClelland
dc03637ae3
htlcswitch: rename for test parameters for accuracy 2024-08-01 11:56:50 -07:00
Keagan McClelland
f54c9ea8f7
htlcswitch: replace errors package implementation 2024-07-31 17:54:21 -07:00
Keagan McClelland
1f9cac5f80
htlcswitch: refactor dust handling to use ChannelParty 2024-07-31 14:50:27 -07:00
Keagan McClelland
0996e4f163
multi: refactor lnwallet/channel.go to use ChannelParty in select places
We also include changes to contractcourt, htlcswitch and peer to stitch the
boundaries together.
2024-07-31 14:50:26 -07:00
ziggie
02c1264c53
multi: prevent nil panics in stop methods.
With this PR we might call the stop method even when the start
method of a subsystem did not successfully finish therefore we
need to make sure we guard the stop methods for potential panics
if some variables are not initialized in the contructors of the
subsystems.
2024-07-31 14:43:34 +02:00
ziggie
08b68bbaf7
multi: Add atomic start/stop functions.
Make sure that each subsystem only starts and stop once. This makes
sure we don't close e.g. quit channels twice.
2024-07-31 13:12:19 +02:00
Oliver Gugger
ac4ef28926
Merge pull request #8824 from Crypt-iQ/precise_dust_limit
multi: include commitment fees in dust calculation
2024-07-31 03:13:31 -06:00
Eugene Siegel
d6001d033b
htlcswitch+lnwallet: calculate fee exposure as commit fees + dust
This commit expands the definition of the dust limit to take into
account commitment fees as well as dust HTLCs. The dust limit is now
known as a fee exposure threshold. Dust HTLCs are fees anyways so it
makes sense to account for commitment fees as well. The link has
been modified slightly to calculate dust. In the future, the switch
dust calculations can be removed.
2024-07-29 14:13:21 -04:00
Elle Mouton
65aef6a69c
htlcswitch: handle blinded path dummy hops
If a blinded path payload contains a signal that the following hop on
the path is a dummy hop, then we iteratively peel the dummy hops until
the final payload is reached.
2024-07-26 09:54:18 +02:00
Elle Mouton
b0d3e4dc0d
multi: extract path ID and total amt from received payment
We've covered all the logic for building a blinded path to ourselves and
putting that into an invoice - so now we start preparing to actually be
able to recognise the incoming payment as one from a blinded path we
created.

The incoming update_add_htlc will have an `encrypted_recipient_data`
blob for us that we would have put in the original invoice. From this we
extract the PathID which we wrote. We consider this the payment address
and we use this to derive the associated invoice location.

Blinded path payments will not include MPP records, so the payment
address and total payment amount must be gleaned from the pathID and new
totalAmtMsat onion field respectively.

This commit only covers the final hop payload of a hop in a blinded
path. Dummy hops will be handled in the following commit.
2024-07-26 09:54:18 +02:00