Commit graph

70 commits

Author SHA1 Message Date
Ignacio Porte
bb14ecd7ec feat: pay BOLT 12 offers via BIP-353 human-readable names
Resolves a name like `alice@example.com` to a BOLT 12 offer over DoH
and pays it. DNSSEC is validated locally, as required by BIP-353.
Self-resolution only for now; peer-based resolution via BLIP-32 will
follow. Exposes a `PayHumanReadableAddress` gRPC endpoint and a
`lndk-cli pay-hrn` command.
2026-04-18 19:06:00 -04:00
Vincenzo Palazzo
1b28412f6a fix: reject offers with offer_amount=0 per BOLT 12 spec
Validate that offer_amount is non-zero when parsing bolt12 offers,
rejecting malformed offers early per the BOLT 12 specification. Also
update CLI help text to note the amount requirement.

Closes #251.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 07:48:12 +02:00
f3r10
4556ea16e6
itest: testing same node with multiple channels
If a node has multiple channels open, only one them has to be used as a
blinded path, ignoring the rest.
2025-09-25 23:14:11 +02:00
f3r10
ad575148df
tests: Add integration test for check pay offer
This commit adds an integration test for checking the pay offer
feature using 3 available blinded paths, which nodes support onion messages
and are connected to more channels.
2025-09-25 23:14:11 +02:00
f3r10
b4cbe4e770
offers: better peer selection for offers
The current approach uses random peers. These random peers may be
temporary connections, so that if someone tries to pay and offer, the
selected peers may not be connected anymore, and the payment will fail.
Instead of choosing random peers, this commit will select public
open channels, creating long-lived offers. It tries to choose three
different channels at most. In order for these channels to be valid, the node
has to have onion support, and the node has to be connect to more public
channels. This new logic is only for creating offers.

The current logic of choosing random peers is better for outgoing payments
and remains as such.
2025-09-25 23:14:11 +02:00
Maurice
661b50d641
itest: fix flaky test on building network test payment retry
Mine and confirm channel to LND one by one instead of batching to
ensure all channels are open when creating the blinded path and
then closing channels.

LND force close channels when wallet is not in sync with the
blockchain.
2025-09-17 12:12:11 -03:00
Maurice
30fc1c5851
itest: add route error handling
This commit adds a test whenever that checkouts that whenever is a network condition error when tryingto pay an offer after fetching the invoice, we will return the latest error of the payment.
2025-09-15 14:40:22 -03:00
Maurice Poirrier Chuden
77b1b3b8e1
handler: retry pay_invoice on failure for each blinded path
Before this commit we used the first blinded path offered in the
invoice to send the payment. If it failed because network dynamics
we would fail the payment for the end user.

With this commit if we fail to send the payment through the route
we will try with a new one until we don't have options to do the
payment.
2025-09-15 14:40:22 -03:00
Maurice Poirrier Chuden
ba8546f1e8
itest: add wait_for_nodes_addresses on lnd
Adds helper function that waits for all LDK nodes used to have an
address on LND graph.
2025-09-15 11:22:52 -03:00
Maurice Poirrier Chuden
e300a2d365
itest: extract setup ldk node to different function
This commit allow us to do different topologies easier when doing
integration tests.
2025-09-15 11:22:51 -03:00
Maurice
e07a412e6f
chore: bump tonic related crates
This commit upgrades all tonic related crates to the latest
version. Also uses latest own organization tonic_lnd fork.
Finally, fixes all breaking changes of these versions.
2025-09-09 19:07:11 -03:00
Maurice
e8e5611408
tests: add wait_for_addresses_to_sync helper
To test out when peers are not connected we need the graph to sync
with the node addresses to then be connected. The method added
waits for 100s for an specific node to appear in the LND graph.

Finally, as we need more freedom when using `connect_network` we
add a boolean flag ti announce or not the ldk1 <-> ldk2 connection.
2025-09-05 08:59:22 -04:00
Maurice Poirrier Chuden
326dfa4549
tests: add more channel capacity default network 2025-09-05 08:37:20 -04:00
Maurice Poirrier Chuden
5a607f3889
handler: respond to invoice requests with invoices
Whenver an offer message arrives we verify that is from a offer
generated from the lndk keys. Then we create an invoice on LND
side to finally respond the newly generated Invoice through
an oniont message.
For given invoice we add a Nonce and Hmac to authenticate in case
of any error.
Finally, we add a simple integration test of generating an offer
andh then paying it.
2025-09-05 08:37:13 -04:00
Maurice Poirrier Chuden
bbf2d79ae7
offers: add create_offer functionality
Implements BOLT12 offer creation API with OfferCreator trait, handler methods,
and appropriate tests. This allows nodes to create and share BOLT12 offers.
2025-09-05 08:36:05 -04:00
f3r10
2849683ff0 tests: After LND is running check that node address is in sync 2025-08-29 11:38:05 -05:00
f3r10
e8ba2244f8 messenger: increase sleep time on integration test
Because the CI resources are very limited, the time that LND takes to be
up, running and ready to serve increases making the integration tests to
fail. Because of this reason the sleep time is increased.
2025-08-20 12:35:04 -05:00
f3r10
cbcf056681 messager: remove unnecessary prefix underscore, fix comments format, add
missing parameters in integration_tests
2025-08-18 11:48:27 -05:00
f3r10
f01cf04bbf messager: add a pulling method to check that LND is running for
integration tests
2025-08-17 14:57:36 -05:00
f3r10
4a401776ca messenger: add a integration test to check reconnection.
This commit adds a integration test for checking that when a LND node is
not available the reconnection wrapper will keep trying to reconnect
making possible to use the same handler for trying to pay an offer.
When the LND is broken the first pay offer will fail whereas when the
reconnection succeed the second attempt of pay a offer will finish.
It was also necessary to abstract how LND arguments are generated in order
to restart LND node using previous arguments.
2025-08-17 14:57:36 -05:00
Ignacio Porte
5681b1124b cli: add fees limits args to pay_invoice and pay_offer 2025-08-11 23:01:09 -04:00
Maurice
d19dba336d
trait: implement PeerConnector to ligthning client
This commit changes the implementation of `PeerConnector` from the
broad tonic client of LND to the specific `LightningClient`.
2025-08-04 13:34:07 -04:00
Maurice Poirrier Chuden
31e6fff0d7
tests: test get_invoice flow on integration tests
This commit changes `test_lndk_send_invoice_request` to
`test_lndk_get_invoice`. Main difference is that we now wait to
receive the invoice back when sneding an invoice request.
Also, adds a helper function `get_invoice_with_retry` to retry
in case of failure because there is a race condition between
the internal graph and when wecall get_invoice.
2025-07-08 09:41:52 -07:00
Maurice Poirrier Chuden
9aff9cdcc0
tests: use create_reply_path from lnd_requests in integration 2025-07-08 09:41:51 -07:00
Maurice Poirrier Chuden
487cf9a3e0
tests: move test_trasient_keys from integration to lnd_requests 2025-07-08 09:41:51 -07:00
Maurice Poirrier Chuden
77294fde21
tests: upgrade integration tests
this commits updates integration test to work with
latest ldk, ldk-sample and bitcoin versions
2025-05-22 08:02:22 -04:00
Maurice Poirrier Chuden
64fc80719c
tests: store stderr and stdout logs lnd itest
objective is to catch any bug while spawning the command until
lnd logs or datadir is created.
2025-04-24 08:06:16 -04:00
Maurice Poirrier Chuden
434301abfd
chore: itest behind cfg and feature
As Itest has specific dependencies, main
package does not require all of them neither
downloading bitcoin core. This commits
creates a cfg flag and feature to separate
on build time and dependencies.
2025-04-24 08:06:16 -04:00
Maurice Poirrier Chuden
7e330c0cad
chore: use corepc-node instead of bitcoind
bitcoind in rust-bitcoin/bitcoind#169 was moved to
corepc-node. This commits upgrades integration tests
to use latest version of corepc-node.
2025-04-17 18:34:57 -04:00
Matthew Rheaume
7335927af5 Fall back to data_dir if log_file is unspecified. 2024-11-18 22:21:13 -08:00
Matthew Rheaume
a47a2ff5a9 Renamed log_dir configuration to log_file.
This is expected to be passed in as a file, not a directory, so change
the name to reflect that fact.
2024-11-18 22:18:15 -08:00
dunxen
ea35b47d60
Merge pull request #153 from kannapoix/make-rate-limit-configurable 2024-11-08 23:41:42 +02:00
UK
8d34e5ba4c Make rate limits configureable.
Add 'rate_limit_count' and 'rate_limit_period' to configuration option.
2024-10-15 10:28:26 +09:00
Orbital
5acb051643
offers: don't choose unadvertised node as introduction node 2024-08-28 12:55:41 -05:00
Orbital
3bd831af90
multi: move to derive_new_key for key gen
We should use a new key to sign each invoice request to improve sender privacy
and to ensure we can pay a particular CLN offer more than once.
2024-08-12 21:09:27 -05:00
Maurice Poirrier Chuden
856eb68c1f
multi: Configurable timeout for receiving invoice
This commit introduces a parameter in the RPC to allow users to modify
the timeout when receiving an invoice from the offer creator.

Additionally, it adds a configuration parameter for the server to set
up a default value if no parameter is used.

The default timeout value is also decreased from 100 seconds to 20
seconds.
2024-08-09 22:41:11 +02:00
Orbital
f499cdd602
multi: allow passing in a payer note 2024-07-31 16:29:43 -05:00
UK
691363ee21 Add skip-version-check option.
LNDK verifies that the version of LND running alongside it is compatible with LNDK.
If users need to bypass this version check for any reason, they can use the skip-version-check option.
2024-07-16 10:18:06 +09:00
jbesraa
aae75418c9
Remove wait_to_receive_onion_message test 2024-07-09 10:51:22 +03:00
Orbital
1d48f29812
offers: track active payments instead of offers
Instead of tracking the offers we're paying, we move to instead track active
payments by PaymentId through their lifecycle.

This makes it easier for us to track whether we've already received an invoice
for the payment or not. If we have, we ignore the second invoice so we don't
try to pay it again.

As a byproduct, this change also allows us to pay the same offer multiple at
once, which we didn't allow for before.
2024-07-02 17:57:30 -05:00
Orbital
1e774d2050
tests: split out setup_lndk fn for reuse 2024-07-02 17:57:29 -05:00
Orbital
ccb1ebaa56
tests: split off connect_network fn for reuse 2024-07-02 17:57:29 -05:00
Orbital
8d41e91d66
offers: split create_invoice_request from send_invoice_request
Splitting create_invoice_request out makes it easier for us to access the
PaymentId through the duration of the payment's lifecycle.
2024-07-02 17:54:46 -05:00
Orbital
0d1a417aae
multi: format comments to 100 width 2024-06-07 21:50:38 -05:00
Orbital
d9ef3dbae4
multi: setup grpc server 2024-05-29 17:04:47 -05:00
Orbital
d858e0983e
multi: delete started channel
With the grpc server, we don't need to check whether the onion messenger has
started before we pay an offer - we know it's already running.
2024-05-28 21:09:14 -05:00
Orbital
94b6b719af
main+lib: move logger out of run method
We move logger setup into main, so we're able to access the logger when we
start up the server.
2024-05-28 21:09:14 -05:00
Orbital
9904ee0f9c
lib: move and Arc-ify OffersHandler
This commit Arc-ifies the reference to OffersHandler, which is necessary
because once we set up the grpc server, we'll need a second thread-safe
reference to it.
2024-05-28 21:09:13 -05:00
Orbital
9735c2c95f
multi: add option to pass cert/macaroon in directly to lndk 2024-05-21 14:23:21 -05:00
Orbital
fe1601cf47
main: add config option for specifying log level 2024-03-19 15:54:31 -05:00