Commit graph

122 commits

Author SHA1 Message Date
jbesraa
f8904ff385
Upgrade rust-lightning to 0.0.123
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
2024-07-09 10:51:22 +03:00
Orbital
d844f75932
offers: improve offer flow logs 2024-07-05 15:03:35 -05: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
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
e3126865b0
offers: return PaymentId for later use
We'll need this id to track the lifecycle of each payment.
2024-07-02 17:53:27 -05:00
Orbital
656bbf5cb2
offers: change OfferState to PaymentState 2024-07-01 22:05:55 -05:00
Orbital
dd98a219a9
cli: return error code on error 2024-06-24 00:21:51 -05:00
Orbital
15bbe3fcab
cli: add option to pass in LNDK tls cert directly
Some users would rather pass in the TLS cert directly as a pem-encoded string,
rather than pull it from a file.
2024-06-18 23:33:33 -05:00
Orbital
15220f7cfe
cli: TLS connection with server 2024-06-18 23:33:32 -05:00
Orbital
509453ce0f
server: require TLS for interacting with server
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.
2024-06-18 23:33:32 -05:00
Orbital
bce3a67ca1
main: auto-create data directory at ~/.lndk 2024-06-18 23:33:28 -05:00
Maurice Poirrier Chuden
b341ace87b
logs: add ldk sublogger
This commit introduces an ldk sublogger using log4rs. The new logger is then utilized in  MessengerUtilities, where it is passed to create LDKCreateOnionMessenger instance
2024-06-18 20:09:19 -04:00
Orbital
27df32b670
Remove unnecessary text 2024-06-08 13:27:01 -05:00
Orbital
0d1a417aae
multi: format comments to 100 width 2024-06-07 21:50:38 -05:00
Orbital
eb321f384c
main: add grpc server config options
Co-authored-by: Tom <tom@strike.me>
2024-05-29 22:58:29 -05:00
Orbital
ed7a8779c1
cli: update CLI to connect to new gRPC server
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.
2024-05-29 22:54:00 -05:00
Orbital
d9ef3dbae4
multi: setup grpc server 2024-05-29 17:04:47 -05:00
Orbital
2952280f21
multi: expose payment when done tracking it 2024-05-28 21:09:15 -05:00
Orbital
0ad9670009
lib: remove offer from map if we fail/succeed to pay
That way, we don't get a "AlreadyProcessing" error if the client attempts to
pay the offer a second time.
2024-05-28 21:09:15 -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
a7675678c1
lnd: move get network logic into separate function 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
e51a15e8ca
onion: remove RefCell from MessengerUtilities
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.
2024-05-28 21:09:13 -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
orbitalturtle
c66bdbae42
Merge pull request #109 from orbitalturtle/load-creds-directly
Add the option to load cert/macaroon directly into lndk
2024-05-23 17:33:09 -05:00
Orbital
ef07ebbf35
cli: add option to pass cert/macaroon in directly to cli 2024-05-21 14:23:25 -05:00
Orbital
53ff36722f
cli: default macaroon path should depend on the specified network 2024-05-21 14:23:25 -05:00
Orbital
9735c2c95f
multi: add option to pass cert/macaroon in directly to lndk 2024-05-21 14:23:21 -05:00
Orbital
e654ddc543
clippy: move outer attribute into inner 2024-05-16 17:50:20 -05:00
Orbital
0ffdeaace1
cli: Add cli command to pay offer 2024-03-28 14:10:55 -05:00
Orbital
bcb76c0e76
cli: add global arguments for connecting to lnd 2024-03-28 13:58:07 -05:00
Orbital
fe2943572b
lnd: convert network string to lowercase before processing 2024-03-28 13:58:06 -05:00
Orbital
f946fa0b53
lnd: export get_lnd_client, features_support_onion_messages & network checker 2024-03-28 13:58:06 -05:00
Orbital
53fef9dbb4
lnd: export network verifier for cli 2024-03-28 13:58:06 -05:00
Orbital
74cdd862db
offers: add timeout for invoice response 2024-03-28 13:58:03 -05:00
Orbital
f201996ff7
lib: when finding route, add missing fee ppm parameter 2024-03-27 21:49:41 -05:00
Orbital
fe1601cf47
main: add config option for specifying log level 2024-03-19 15:54:31 -05:00
Orbital
fca3f69148
logs: filter out useless dependency logs 2024-03-19 15:43:06 -05:00
Orbital
4b491cc7ff
multi: send offer payment 2024-03-06 15:27:46 -06:00
Orbital
c6c3e2144d
offers: add InvoicePayer for paying an offer 2024-03-06 15:27:45 -06:00
Orbital
16847c03ab
multi: Upgrade to ldk v20
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
2024-03-06 15:27:45 -06:00
Orbital
39e92e8baf
Bump tonic_lnd to a custom version
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.
2024-03-06 15:27:45 -06:00
Orbital
df53046443
offers: verify invoice upon return 2024-03-06 15:26:13 -06:00
Orbital
a6c72c6508
multi: split off uir signing portion of create_invoice_request into a method
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.
2024-03-06 15:26:13 -06:00
Orbital
bf03063310
multi: add verification details to invoice request
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.
2024-03-06 15:26:13 -06:00
Orbital
b85cad4d8c
offers: send invoice request 2024-03-06 15:21:02 -06:00
Orbital
3b09ec2bc7
offers: Build a reply path for invoice request 2024-03-06 15:21:00 -06:00
Orbital
f97bd3d000
offers: wait for onion messenger ready signal before sending request
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.
2024-03-06 15:21:00 -06:00
Orbital
ac957e40a9
offers: validate offer amount user input 2024-03-06 15:20:59 -06:00
Orbital
780d0fbf34
offers: add logic for connecting to the introduction node peer 2024-03-06 15:20:59 -06:00