Commit graph

17093 commits

Author SHA1 Message Date
Eugene Siegel
3e318b4187 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 18:51:38 -05:00
Eugene Siegel
b7c4a3cd18 discovery: add banman for channel announcements
This commit introduces a ban manager that marks peers as banned if
they send too many invalid channel announcements to us. Expired
entries are purged after a certain period of time (currently 48 hours).
2024-08-27 18:51:38 -05:00
Eugene Siegel
4558eb04d0 channeldb: add PutClosedScid and IsClosedScid
This commit adds the ability to store closed channels by scid in
the database. This will allow the gossiper to ignore channel
announcements for closed channels without having to do any
expensive validation.
2024-08-27 18:51:38 -05:00
Olaoluwa Osuntokun
e431e5b71f Merge branch '0-18-3-branch-9026' into 0-18-3-branch 2024-08-26 20:19:31 -05:00
ziggie
72929079c9 docs: add release-notes. 2024-08-26 20:19:31 -05:00
ziggie
59355b17a5 blindedpath: minHTLC for blinded path change.
We will not add a buffer to the chan policy for blinded paths in case
the sender amount violates the minHTLC restriction in the first place.

Moreover we disgard a route fast if the payment amount is smaller than
the minHTLC along the route.
2024-08-26 20:19:31 -05:00
ziggie
89ef3737b1 blindedpath: fix log output. 2024-08-26 20:19:31 -05:00
ziggie
38c81516ec blindedpath: remove blockexpiry check.
Removes a check where we would NOT allow to create a blinded invoice
with an expiry (invoice expiry in seconds considered as block time)
lower than the min_final_ctlv_delta.
2024-08-26 20:19:31 -05:00
Olaoluwa Osuntokun
dbe4ca3efe Merge branch '0-18-3-branch-9011' into 0-18-3-branch 2024-08-26 20:19:11 -05:00
ziggie
4102e33670 docs: update release-notes. 2024-08-26 20:19:11 -05:00
ziggie
d906010508 discovery: add detailed comment.
Describe why it is ok to resurrect zombie channels based on the
timestamp of the `ReplyChannelRange` msg although its not verifiable
data.
2024-08-26 20:19:11 -05:00
ziggie
44413868c7 multi: fix time.Time initialization.
ChanUpdate timestamps are now restircted so that they cannot be
more than two weeks into the future. Moreover channels with both
timestamps in the ReplyChannelRange msg either too far in the past
or too far in the future are not queried.

Moreover fix unitests.
2024-08-26 20:19:11 -05:00
ziggie
b23e69c0b7 discovery: fix log line.
if we use %x here we would get the hex representation of the
String() method of the vertex, which is wrong.
2024-08-26 20:19:11 -05:00
Olaoluwa Osuntokun
53799e9f91 Merge branch '0-18-3-branch-9002' into 0-18-3-branch 2024-08-26 20:18:47 -05:00
Olaoluwa Osuntokun
57221bd760 discovery: fix bug that can lead to sending invalid chan_ann msgs
Initially in lnd, we didn't store the extra TLV data that could be
dangling off of gossip messages. This was fixed initially in lnd v0.5
with this PR: https://github.com/lightningnetwork/lnd/pull/1825.

Within the PR, we incorrect set the `ExtraOpaqueData` (extra TLV blob)
of the `ChannelAnnouncement` to the value stored in `edge`, which is
actually our channel update. As 6-ish years ago we didn't yet have
anything that used the TLV gossip fields, this went unnoticed.

Fast forward to 2024, we shipped an experimental version of inbounbd
fees. This starts to store additional data in the `ExtraOpaqueData`
field, the TLV for the inbound fee. Initially, everything is valid when
the first `ChannelAnnouncement` is sent, but as soon as a user attempts
to set an inbound fee policy, we'd incorrectly swap in that new
serialized TLV for the _channel announcement_:
841e24399c (diff-1eda595bbebe495bd74a6a0431c46b66cb4e8b53beb311067c010feac2665dcbR2560).

Since we're just trying to generate a new `channel_update`, we don't
also regenerate the signature for the `channel_announcement` message. As
a result, we end up storing a `channel_announcement` with an invalid sig
on disk, continuing to broadcast that to peers.
2024-08-26 20:18:29 -05:00
Oliver Gugger
8f25de054d
Merge pull request #9023 from ellemouton/testHTLCPersistenceAcrossRestart
lnwallet: correctly set UpdateAddHTLC.BlindingPoint on reload from disk
2024-08-22 07:29:50 -06:00
Elle Mouton
e99b09d38a
docs: update release notes 2024-08-22 14:21:30 +02:00
Elle Mouton
fcbd1e14d3
lnwallet+itest: fix PaymentDescriptor creation for blinded path htlc
This commit fixes the instantiation of the BlindingPoint member of
PaymentDescriptor during the conversion from persisted LogUpdates.
Previously, the blinding point was not set correctly. The test from the
previous commit is also updated to now assert that this behaviour is now
correct.
2024-08-22 14:21:30 +02:00
Elle Mouton
58fa379cc7
itest: demonstrate UpdateAddHTLC reloading bug
This commit adds a new route blinding itest that demonstrates that the
reloading and re-forwarding of an UpdateAddHTLC message on restart
currently is done incorrectly for a blinded path payment. This is due to
the fact that the blinding point member is not currently set correctly.
This is fixed in the next commit which will also change the test to
assert that the behaviour is now correct.
2024-08-22 14:21:30 +02:00
Olaoluwa Osuntokun
8d5f66b5fc
Merge pull request #8995 from Roasbeef/0-18-3-branch-rc1
build: bump to v0.18.3-beta.rc1
2024-08-09 13:58:50 -07:00
Olaoluwa Osuntokun
7c2cf49d66
build: bump to v0.18.3-beta.rc1 2024-08-09 13:58:05 -07:00
Olaoluwa Osuntokun
57a5e4912b
Merge pull request #8994 from ellemouton/rbMicroFixes
Rb micro fixes
2024-08-08 11:17:16 -07:00
Elle Mouton
ab28cde240
routing: correct initial finalPaddedSize
This purely affects logging. This makes sure that the `padStat`
finalPaddedSize field is initilised correctly with the given minSize.
2024-08-08 16:46:04 +02:00
Elle Mouton
5e84ba92af
multi: add IsBlinded to lnrpc.Invoice for nicer UX
The BlindedPathConfig struct is nice for invoice creation but when we
use the Invoice message for viewing an invoice, it would be nicer to see
an "is_blinded" field.
2024-08-08 16:46:01 +02:00
Oliver Gugger
bbd313dcca
Merge pull request #8992 from guggero/estimate-fee-cli
cmd/lncli: add min relay fee to `lncli wallet estimatefeerate`
2024-08-08 01:43:56 -06:00
Oliver Gugger
eac54601fb
cmd/lncli: add min relay fee to lncli wallet estimatefeerate
This commit adds the new value that was added to the RPC response to the
CLI output as well.
2024-08-08 09:24:49 +02:00
Olaoluwa Osuntokun
5a84ca8032
Merge pull request #8986 from Roasbeef/min-relay-fee-rpc
lnrpc: add new min_relay_fee response to EstimateFee
2024-08-07 21:01:54 -07:00
Olaoluwa Osuntokun
51f3577ef9
Merge pull request #8963 from Roasbeef/always-send-chan-upd
peer: always send channel update on reconnect
2024-08-07 18:50:34 -07:00
Olaoluwa Osuntokun
459ee9b245
Merge pull request #8976 from ellemouton/rb-follow-ups
route blinding: follow ups
2024-08-07 17:54:31 -07:00
Olaoluwa Osuntokun
7f96d10dd3
lnrpc: add new min_relay_fee response to EstimateFee
We also start using a pattern of making new messages for types/units
instead of adding a suffix to a field.
2024-08-07 17:51:35 -07:00
Olaoluwa Osuntokun
9acad37f57
peer: always send channel update on reconnect
We have existing logic to attempt to reliably send a channel update to
the remote peer. In the wild, we've seen this fail, as it's possible
right when we send the update the peer disconnects.

In this commit, we implement a simple fix which is just to send the chan
update each time we connect to the remote party.

Fixes https://github.com/lightningnetwork/lnd/issues/6870.
2024-08-07 17:48:50 -07:00
Elle Mouton
f1a58dcab1
lnwire: update Bolt11 blinded path feature bits
so that they dont clash with the htlc-endorsement feature bits.
2024-08-07 20:13:34 +02:00
Yong
a449a5d132
Merge pull request #8174 from yyforyongyu/fix-inflight-payments
routing: fix stuck inflight payments
2024-08-07 23:23:27 +08:00
Elle Mouton
d47ff3af79
docs: add release note 2024-08-07 17:03:12 +02:00
Elle Mouton
697f514d09
blindedpath: log chosen blinded paths
In this commit, we log selected blinded paths.
2024-08-07 17:03:12 +02:00
Elle Mouton
95477390a4
log: register blindedpath pkg logger 2024-08-07 17:03:12 +02:00
Elle Mouton
48a9a8d20e
zpay32: add functional opt to error out on unknown feature bit
This commit adds two functional options to the zpay32.Decode function.
`WithKnownFeatureBits` allows the caller to overwrite the default set of
known feature bits used by the function.
`WithErrorOnUnknownFeatureBit` allows the caller to instruct the
function to error out if the invoice that is decoded contaijns unknown
feature bits. We then use this new error-out option from the
`rpcServer`'s `extractPaymentIntent` method.
2024-08-07 17:03:12 +02:00
Elle Mouton
e4619afc08
multi: add node omission list for blinded paths 2024-08-07 17:03:11 +02:00
Elle Mouton
b490deefdf
routing/blindedpath: dont error out unless all paths fail
In this commit, we adjust BuildBlindedPaymentPaths to only error out
completely if none of the paths it received from FindRoutes resulted in
a usable blinded path.
2024-08-07 17:02:56 +02:00
Elle Mouton
3de6c5415a
multi: let blinded path invoice options be set per addinvoice call
Extend the configurability of blinded paths in invoices by adding the
ability to change the global config options on a per-RPC basis.
2024-08-07 17:02:55 +02:00
Elle Mouton
ca91e17115
invoicesrpc: move blinded path config to AddInvoiceData
since `AddInvoiceData` is config _per invoice_ where as `AddInvoiceConfig`
is config for the invoice server itself and so pretty much should stay
the same for the lifetime of LND. This change sets us up for moving some
of the blinded path config options to be changeable per AddInvoice call
rather that having fixed config values in the config file.
2024-08-07 17:01:21 +02:00
Elle Mouton
e47160d257
routing: fix MC probability order for blinded paths
Fix the blinded path probability sorting function.
Also fix the test assertion function.
2024-08-07 17:01:21 +02:00
Oliver Gugger
d77617461d
Merge pull request #8955 from yyforyongyu/cr-8516-240729-sendcoins
Allow selecting coins in `sendcoins`
2024-08-07 08:42:25 -06:00
yyforyongyu
bc31a8b36f
routing: fix doc string 2024-08-07 22:19:23 +08:00
yyforyongyu
677f2c390a
lntest: re-define CleanupForceClose
To reflect the new sweeping behavior, also makes it easier to be used as
we need to method to quickly cleanup force closes without concerning the
details when we are not testing the force close behavior.
2024-08-07 22:19:23 +08:00
yyforyongyu
7aba5cbc0a
routing: fix linter complains 2024-08-07 22:19:23 +08:00
yyforyongyu
188aa9a4d4
routing+lnd: prepare closed channel SCIDs in server
The method `FetchClosedChannels` sometimes prematurely mark a pending
force closing channel as finalized, therefore we need to furthur check
`FetchPendingChannels` to make sure the channel is indeed finalized.
2024-08-07 22:19:23 +08:00
yyforyongyu
e8f292edf4
docs: update release notes re stuck payment fix 2024-08-07 22:19:22 +08:00
yyforyongyu
c2f7e6a66f
routing: fail stale HTLC attempts during startup
This commit adds a check during router's startup and fails the inflight
HTLCs if they are routing using channels unknown to us. The channels are
unknown because they are already closed, usually long time ago.
2024-08-07 22:19:21 +08:00
yyforyongyu
b998ce11f1
routing+htlcswitch: add new interface method HasAttemptResult 2024-08-07 22:18:51 +08:00