Commit graph

17220 commits

Author SHA1 Message Date
Olaoluwa Osuntokun
e257188017
peer: update readHandler to dispatch to msgRouter if set
Over time with this, we should be able to significantly reduce the size
of the peer.Brontide struct as we only need all those deps as the peer
needs to recognize and handle each incoming wire message itself.
2024-10-11 14:01:29 +02:00
Olaoluwa Osuntokun
a888573fcc
msgmux: add new abstract message router
In this commit, we add a new abstract message router. Over time, the
goal is that this message router replaces the logic we currently have in
the readHandler (the giant switch for each message).

With this new abstraction, can reduce the responsibilities of the
readHandler to *just* reading messages off the wire and handing them off
to the msg router. The readHandler no longer needs to know *where* the
messages should go, or how they should be dispatched.

This will be used in tandem with the new `protofsm` module in an
upcoming PR implementing the new rbf-coop close.
2024-10-11 14:01:29 +02:00
Oliver Gugger
0719c808dd
Merge branch '0-18-4-branch-rc1-8996' into 0-18-4-branch-rc1 2024-10-11 11:42:24 +02:00
Keagan McClelland
8344699a0d
lntypes: Add Dual[A] primitive type
This commit introduces a new type Dual[A] to make it easier to
manage symmetric configurations or state for lightning channels.
2024-10-11 11:42:23 +02:00
Oliver Gugger
d72a3aaf26
Merge pull request #9088 from Roasbeef/0-18-3-branch
build: bump version to v0.18.3
2024-09-11 05:22:27 -06:00
Olaoluwa Osuntokun
6eea5f3b13
build: bump version to v0.18.3 2024-09-10 19:44:13 -07:00
Olaoluwa Osuntokun
4f40e43b26
Merge pull request #9061 from Roasbeef/0-18-3-branch
release: create branch for v0.18.3 rc3
2024-09-06 15:34:20 -07:00
Olaoluwa Osuntokun
d85ce8415b
build: bump version to v0.18.3 rc3 2024-09-06 12:59:37 -07:00
Olaoluwa Osuntokun
e1351eaa0a Merge branch '0-18-3-branch-9050' into 0-18-3-branch 2024-09-06 12:59:32 -07:00
Olaoluwa Osuntokun
ce442a5083 Merge branch '0-18-3-branch-9046' into 0-18-3-branch 2024-09-06 12:59:32 -07:00
Andras Banki-Horvath
d4fbc815c6 docs: update docs/release-notes/release-notes-0.18.3.md 2024-09-06 12:59:32 -07:00
Olaoluwa Osuntokun
2341019016 lnwallet: expand chan sync tests to cover taproot channels
In this commit, we expand some of the existing chan sync tests to cover
taproot channels (the others already did). Along the way, we always
assert that the `PartialSig` is populated on retransmission. In
addition, we now send the new commit sig rather than the existing
in-memory one to test the new logic that re-signs the commitment.
2024-09-06 12:59:32 -07:00
Andras Banki-Horvath
b62db3733d sqldb: fix end date filter when querying invoices
Previously, the SQL implementation of the invoice query simply
converted the start and end timestamps to time and used them
in SQL queries to check for inclusivity. However, this logic
failed when the start and end timestamps were equal.

This commit addresses and corrects this issue.
2024-09-06 12:59:32 -07:00
Andras Banki-Horvath
9298133614 sqldb+invoices: synchronize SQL invoice updater behavior with KV version
Previously SQL invoice updater ignored the set ID hint when updating an
AMP invoice resulting in update subscriptions returning all of the AMP
state as well as all AMP HTLCs. This commit synchornizes behavior with
the KV implementation such that we now only return relevant AMP state
and HTLCs when updating an AMP invoice.
2024-09-06 12:59:32 -07:00
Andras Banki-Horvath
b3dc3ed5c8 channeldb: filter AMP state to relevant set IDs
When fetching an AMP invoice we sometimes filter HTLCs to selected set
IDs, however we always kept the full AMP state which is irrelevant as it
contains state for all AMP payments. This was a side effect of
UpdateInvoice needing to serialize the whole invoice when storing after
an update but it is an unwanted "feature" as users will need to filter
to relevant set when listing an AMP payment or subsribing to an update.
2024-09-06 12:59:32 -07:00
Alex Akselrod
cadce23b47 invoices: ensure AMP subinvoices are correctly updated w/nativesql 2024-09-06 12:59:32 -07:00
Alex Akselrod
8c6e24346a itest: check that AMP subinvoices are correctly updated w/nativesql 2024-09-06 12:59:32 -07:00
Alex Akselrod
e152a52625 invoices/sqldb: query by ChanID when updating AMP invoice preimage 2024-09-06 12:59:32 -07:00
Olaoluwa Osuntokun
d13908881c lnwallet: extract initMusigNonce from initRevocationWindows
This'll be useful later to make some enhancements to the existing unit
tests.
2024-09-03 17:26:06 -07:00
Olaoluwa Osuntokun
c7300f452c lnwallet: ensure we re-sign retransmitted commits for taproot channels
In this commit, we fix an existing bug with the taproot channel type
that can cause force closes if a peer disconnects while attempting to
send the commitment signature.

Before this commit, since the `PartialSig` we send is never committed to
disk, the version read wouldn't contain the musig2 partial sig. We never
write these signatures to disk, as each time we make a new session, we
need to generate fresh nonces to avoid nonce-reuse.

Due to the above interaction, if we went to re-send a signature after a
disconnection, the `CommitSig` message we sent wouldn't actually contain
a `PartialSigWithNonce`, causing a protocol error.
2024-09-03 17:26:06 -07:00
Olaoluwa Osuntokun
3bb4d6d370
Merge pull request #9036 from Roasbeef/0-18-3-branch
release: bump version to v0.18.3 rc2
2024-08-28 18:48:05 -05:00
Olaoluwa Osuntokun
d111d8d53c
build: bump version to v0.18.3 rc2 2024-08-27 18:52:44 -05:00
Olaoluwa Osuntokun
e69fdf5b83 Merge branch '0-18-3-branch-9009' into 0-18-3-branch 2024-08-27 18:52:20 -05:00
Eugene Siegel
6111ac3468 release-notes: update for 0.18.3 2024-08-27 18:52:10 -05:00
Eugene Siegel
53a8d37df7 discovery: implement ChannelAnnouncement banning
This commit hooks up the banman to the gossiper:
- peers that are banned and don't have a channel with us will get
  disconnected until they are unbanned.
- peers that are banned and have a channel with us won't get
  disconnected, but we will ignore their channel announcements until
  they are no longer banned. Note that this only disables gossip of
  announcements to us and still allows us to open channels to them.
2024-08-27 18:52:10 -05:00
Eugene Siegel
ae33b760f8 graph: export NewErrf and ErrorCode for upcoming gossiper unit tests 2024-08-27 18:52:09 -05:00
Eugene Siegel
de58e3e98e discovery: clean up scid variable usage 2024-08-27 18:51:38 -05:00
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