Among the changes from previous LDK version:
1. No need to pass `Secp256k1Error` to `SignError`
2. `OnionMessenger` takes extra argument which should implement `NL`
referring to `NodeIdLookUp` trait. This required adding new struct
`LndkNodeIdLookUp` to implement the above trait.
3. `path.introduction_node` is replaced in favor of `path.introduction_node()`
4. `OfferBuilder` signature change. `OfferBuilder::new` takes now pubkey instead of disc.
5. Replace `sign_closure` with `LndkSigner` struct and implemented `SignInvoiceRequestFn` trait for it
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.
This PR autogenerates TLS credentials in LNDK's data dir at ~/.LNDK and
requires TLS to be used when connecting to the gRPC server.
Some of this code took inspiration from CLN and TEOS's gRPC servers, so credit
where it's due.
This commit introduces an ldk sublogger using log4rs. The new logger is then utilized in MessengerUtilities, where it is passed to create LDKCreateOnionMessenger instance
This updates the CLI to connect to the LNDK gRPC server in order to make API
calls. We add the necessary macaroon metadata to each request. In addition,
we remove the cert and address flag options because we no longer require
passing in an LND certificate and address to connect to LND.
This commit removes the RefCell in MessengerUtilities, which hampers us from
being able to reference OfferHandler in two different tokio tasks, which we'll
need to do when we set up our grpc server.
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.
We update to ldk v20 for the latest blinded route updates, namely being
able to create a blinded route that's more than one hop. On top of that we use
a custom versoin with a small change, which we need in order to send an onion
message along a specified path for LNDK's integration tests:
lightningdevkit/rust-lightning#2868
We use a custom version of tonic_lnd that has the blinded route support in the
QueryRoute and SendToRoute commands, which won't officially be released in lnd
until v18.
We split the unsigned invoice request (uir) signing portion into
another function to make it easier to mock. Earlier we had hardcoded
a signature for our lndk_offers.rs unit tests. But now that we've
changed the uir being signed (by adding verification metadata), the
hardcoded signature is invalid. We refactor our mocking to get rid of
this hardcoded signature data completely.
Once we get an invoice returned from the offer creator, we'll be able to
verify that the invoice is a response to the invoice request we sent. We can
also use the PaymentId we set to verify we didn't already pay the invoice.
Before we can send an invoice request, LNDK's onion messenger needs to be fully
started and running. We use a channel close to signal when the messenger is
ready.