Commit graph

8257 commits

Author SHA1 Message Date
Matt Corallo
80cdcc2644 Add CHANGELOG entry for 0.0.125 2024-10-14 19:37:03 +00:00
G8XSU
21e90366a3
Revert "Add logging around event processing."
This reverts commit 85eb8145fb.
Logging here can be overly verbose and moreover in case of event
handling failure, we loop back without any added delay.
2024-10-14 11:28:29 -07:00
Matt Corallo
46d8a0db79
Merge pull request #3354 from tnull/2024-10-fix-block-init-synchronize
`lightning-block-sync`: Fix `synchronize_listeners` always calling default implementation
2024-10-14 17:03:09 +00:00
Matt Corallo
64c12431b7 Drop lightning::ln::features::* type aliases
These were deprecated in 0.0.124, and we drop them here in favor of
`lightning::types::features::*`.
2024-10-13 13:52:56 +00:00
Arik Sosman
268675a743
Document monitor archival idempotency requirement. 2024-10-11 09:44:38 -07:00
Matt Corallo
ad19d93180
Merge pull request #3349 from TheBlueMatt/2024-10-3270-followups
Minor #3270 Followups
2024-10-11 13:47:39 +00:00
Matt Corallo
cb4584aff1
Merge pull request #3353 from tnull/2024-10-simplify-block-sync
Drop unnecessary `Result` in `RpcClient::new`
2024-10-11 13:45:53 +00:00
Elias Rohrer
f4fe450921
Fix synchronize_listeners calling default implementation
Previously, the `ChainListenerSet` `Listen` implementation wouldn't
forward to the listeners `block_connected` implementation outside of
tests. This would result in the default implementation of
`Listen::block_connected` being used and the listeners implementation
never being called.
2024-10-10 17:16:18 +02:00
Elias Rohrer
88cbb4ffff
Drop unnecessary Result in RestClient::new
.. as it's infallible
2024-10-09 19:35:42 +02:00
Elias Rohrer
4cdb12f912
Drop unnecessary Result in RpcClient::new
.. as it's infallible
2024-10-09 16:52:29 +02:00
Matt Corallo
43e28fe3a4
Merge pull request #3339 from arik-so/lint-script-file
Create script file for easy local linting
2024-10-09 14:09:13 +00:00
Arik Sosman
46c2c815bf
Create script file for easy local linting 2024-10-08 14:00:43 -07:00
Matt Corallo
a952d2d3d3
Merge pull request #3346 from TheBlueMatt/2024-10-dns-feature-flag
Add support for parsing the dns_resolver feature bit
2024-10-08 19:46:11 +00:00
Matt Corallo
f94bf98612
Merge pull request #3235 from Mirebella/add-local-balance-msats
Add `last_local_balance_msats` field
2024-10-08 17:56:46 +00:00
Matt Corallo
e4ec9176c5
Merge pull request #3351 from carlaKC/arch-update-keys-interface
docs/trivial: update diagram to reflect changes to KeysInterface
2024-10-08 15:30:56 +00:00
Mirebella
5d48d588ef Add Event::ChannelClosed::last_local_balance_msats
Users commonly want to know what their balance was when a channel
was closed, which this provides in a somewhat simplified manner.

It does not consider pending HTLCs and will always overstate our
balance by transaction fees.
2024-10-08 15:28:58 +00:00
Carla Kirk-Cohen
7c1db56d39
arch: update diagram to reflect changes to KeysInterface
KeysInterface was split into EntropySource, SignerProvider and
NodeSigner in #1930.
2024-10-08 10:35:14 -04:00
Leo Nash
9e30f2560d Stop sending channel_update in onion failures
Per <https://github.com/lightning/bolts/pull/1173>.

Fixes #3277
2024-10-05 03:39:06 +00:00
Matt Corallo
5c1440afec Hold a reference to byte arrays when serializing to bech32
When we serialize from a byte array to bech32 in
`lightning-invoice`, we can either copy the array itself into the
iterator or hold a reference to the array and iterate through that.

In aa2f6b47df we opted to copy the
array into the iterator, which is fine for the current array sizes
we're working with, but does result in additional memory on the
stack if, in the future, we end up writing large arrays.

Instead, here, we switch to using the slice serialization code when
writing arrays, (very marginally) reducing code size and reducing
stack usage.
2024-10-03 22:21:55 +00:00
Matt Corallo
052e7c3df0 Marginally reduce allocations in lightning-invoice
In aa2f6b47df we refactored
`lightning-invoice` de/serialization to use the new version of
`bech32`, but in order to keep the public API the same we
introduced one allocation we could have skipped.

Instead, here, we replace the public `Utf8Error` with
`FromUtf8Error` which contains the original data which failed
conversion, removing an allocation in the process.
2024-10-03 17:26:01 +00:00
Matt Corallo
c5658f6cc2 Check that the HRPs generated in BOLT 11 RawHrp are always valid
...in `debug_assertions`.
2024-10-03 17:24:59 +00:00
Matt Corallo
0abf068ad1 Drop one unnecessary allocation added in aa2f6b47df
In aa2f6b47df we refactored
`lightning-invoice` de/serialization to use the new version of
`bech32`, but ended up adding one unnecessary allocation in our
offers logic, which we drop here.
2024-10-03 17:23:32 +00:00
Matt Corallo
cc72f032dc Marginally reduce allocations in lightning-invoice
In aa2f6b47df we refactored
`lightning-invoice` de/serialization to use the new version of
`bech32`, also reducing some trivial unnecessary allocations when
we did so.

Here we drop a few additional allocations which came up in review.
2024-10-03 17:20:07 +00:00
Matt Corallo
bc1931bd0b
Merge pull request #3270 from optout21/bech32-iterser
Upgrade bech32 dependency (iterative)
2024-10-03 17:02:55 +00:00
optout
aa2f6b47df
Upgrade bech32 dependency, bech32 serialization improvements 2024-10-02 21:21:07 +02:00
Matt Corallo
457b634d09 Allow a DNSResolverMessageHandler to set dns_resolver feature
A `DNSResolverMessageHandler` which handles resolution requests
should want the `NodeFeatures` included in the node's
`node_announcement` to include `dns_resolver` to indicate to the
world that it provides that service. Here we enable this by
requesting extra feature flags from the `DNSResolverMessageHandler`
in the features `OnionMessenger`, in turn, provides to
`PeerManager` (which builds the `node_announcement`).
2024-10-02 18:24:40 +00:00
Matt Corallo
1abbe2a237 Add support for parsing the dns_resolver feature bit
This feature bit is used to indicate that a node will make DNS
queries on behalf of onion message senders, returning DNSSEC TXT
proofs for the requested names.

It is used to signal support for bLIP 32 resolution and can be used
to find nodes from which we can try to resolve BIP 32 HRNs.
2024-10-02 18:24:40 +00:00
Arik
d49a08a824
Merge pull request #3179 from TheBlueMatt/2024-07-human-readable-names-resolution-1
Add the core functionality required to resolve Human Readable Names
2024-10-02 10:00:13 -07:00
Matt Corallo
605952cefd
Merge pull request #3301 from dunxen/2024-9-fixnevertypefallback
Add an explicit_type TLV syntax for avoiding certain cases of type inference
2024-10-02 14:29:09 +00:00
optout
ad80e919ec Add Bolt11InvoiceFeatures serialization tests 2024-10-02 15:28:29 +02:00
Duncan Dean
c0d84e85c7
Add an explicit_type TLV syntax for avoiding certain cases of type inference
This new syntax is used to fix "dependency on fallback of ! -> ()".
This avoids cases where code compiles with a fallback of the
never type leading to the unit type. The behaviour in Rust edition 2024
would make this a compile error.

See: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint/builtin/static.DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK.html#
2024-10-02 13:08:04 +02:00
Matt Corallo
d13f336d16 Use a MessageSendEvent-handling fn rather than a single lopp
Rather than building a single `Vec` of `MessageSendEvent`s to
handle then iterating over them, we move the body of the loop into
a lambda and run the loop twice. In some cases, this may save a
single allocation, but more importantly it sets us up for the next
commit, which needs to know from which handler the
`MessageSendEvent` it is processing came from.
2024-10-01 16:49:38 +00:00
Matt Corallo
4147de2cf0
Merge pull request #3324 from tnull/2024-09-rustfmt-util-1
`rustfmt`: Run on `util/*` (1/2)
2024-10-01 15:33:17 +00:00
Matt Corallo
c7627dfd61
Merge pull request #3311 from TheBlueMatt/2024-09-3010-followups
Quick #3010 followups
2024-09-30 21:21:20 +00:00
Matt Corallo
d156b2e30e Call ChannelMessageHandler::message_received without peer lock
While `message_received` purports to be called on every message,
prior to the message, doing so on `Init` messages means we have to
call `message_received` while holding the per-peer mutex, which
can cause some lock contention.

Instead, here, we call `message_received` after processing `Init`
messages (which is probably more useful anyway - the peer isn't
really "connected" until we've processed the `Init` messages),
allowing us to call it unlocked.
2024-09-30 18:57:52 +00:00
Matt Corallo
b8695b0c83 Check that we aren't reading a second message in BOLT 12 retry test
`creates_and_pays_for_offer_with_retry` intends to check that we
re-send a BOLT 12 `invoice_request` in response to a
`message_received` call, but doesn't actually test that there were
no messages in the outbound buffer after the initial send, which we
do here.
2024-09-30 18:57:52 +00:00
Matt Corallo
9335c9bbf7 Add the core functionality required to resolve Human Readable Names
This adds a new utility struct, `OMNameResolver`, which implements
the core functionality required to resolve Human Readable Names,
namely generating `DNSSECQuery` onion messages, tracking the state
of requests, and ultimately receiving and verifying `DNSSECProof`
onion messages.

It tracks pending requests with a `PaymentId`, allowing for easy
integration into `ChannelManager` in a coming commit - mapping
received proofs to `PaymentId`s which we can then complete by
handing them `Offer`s to pay.

It does not, directly, implement `DNSResolverMessageHandler`, but
an implementation of `DNSResolverMessageHandler` becomes trivial
with `OMNameResolver` handling the inbound messages and creating
the messages to send.
2024-09-30 18:04:01 +00:00
Matt Corallo
829dc34d10 Allow _ in Hostnames
These are perfectly fine and are relied on by BIP 353, so we need
to ensure we allow them.
2024-09-30 18:04:01 +00:00
Matt Corallo
75d20e5a5c Add a type to track HumanReadableNames
BIP 353 `HumanReadableName`s are represented as `â‚¿user@domain` and
can be resolved using DNS into a `bitcoin:` URI. In the next
commit, we will add such a resolver using onion messages to fetch
records from the DNS, which will rely on this new type to get name
information from outside LDK.
2024-09-30 16:19:33 +00:00
Matt Corallo
ebde296abd Parse and handle DNSResolverMessages in OnionMessenger
This adds the requisite message parsing and handling code for the
new DNSSEC messages to `OnionMessenger`.
2024-09-30 16:19:33 +00:00
Matt Corallo
1cf0393056 Add DNS(SEC) query and proof messages and onion message handler
This creates the initial DNSSEC proof and query messages in a new
module in `onion_message`, as well as a new message handler to
handle them.

In the coming commits, a default implementation will be added which
verifies DNSSEC proofs which can be used to resolve BIP 353 URIs
without relying on anything outside of the lightning network.
2024-09-30 16:19:31 +00:00
Matt Corallo
151a8a1aaf Add a MessageContext::DNSResolution to protect against probing
When we make a DNSSEC query with a reply path, we don't want to
allow the DNS resolver to attempt to respond to various nodes to
try to detect (through timining or other analysis) whether we were
the one who made the query. Thus, we need to include a nonce in the
context in our reply path, which we set up here by creating a new
context type for DNS resolutions.
2024-09-30 16:19:31 +00:00
Matt Corallo
a661c92746
Merge pull request #3341 from TheBlueMatt/2024-09-gossip-rustfmt-cleanup
Minor `gossip.rs` `rustfmt` cleanups
2024-09-27 00:53:08 +00:00
Matt Corallo
bc5213dfef Minor gossip.rs rustfmt cleanups
Just a few minor updates to `gossip.rs` to reduce code verticality
and simplify things a bit.
2024-09-26 06:45:50 +00:00
valentinewallace
053281f5ad
Merge pull request #3336 from tnull/2024-09-rustfmt-router
`rustfmt`: Run on the `routing` directory (1/3)
2024-09-25 13:20:36 +09:00
Elias Rohrer
5ce2442d43
Merge pull request #3334 from arik-so/lint_fixes
Fix linter complaints
2024-09-25 11:16:08 +09:00
Elias Rohrer
f299a48695
rustfmt: Drop routing/gossip.rs from exclusion list 2024-09-24 13:51:52 +09:00
Elias Rohrer
22b82d36e2
rustfmt: Run on routing/gossip.rs 2024-09-24 13:51:52 +09:00
Arik Sosman
d340ac3b39
Suppress linter warnings
Allow `map_err` and `dependency_on_unit_never_type_fallback` pending
a future MSRV increase.
2024-09-24 13:40:40 +09:00
Elias Rohrer
a0d0f02ed0
Merge pull request #3303 from TheBlueMatt/2024-09-inbound-payment-id
Add a `PaymentId` for inbound payments
2024-09-24 13:38:16 +09:00