40 Commits
Author SHA1 Message Date
Elle Mouton da43541c63 invoicesrpc: remove direct access to ChannelGraph pointer 2025-02-13 11:45:09 +02:00
Oliver Gugger d37df75bc0 lnrpc+rpcserver: encode custom records as custom channel data
With this commit we encode the custom records as a TLV stream into the
custom channel data field of the invoice HTLC.
This allows the custom data parser to parse those records and replace it
with human-readable JSON on the RPC interface.
2024-09-19 09:21:38 +02:00
ffranr 1975fa60e2 invoicesrpc: add HtlcModifier RPC endpoint and modifier RPC server
This commit introduces a singleton invoice HTLC modifier RPC server and
an endpoint to activate it. The server interfaces with the internal
invoice HTLC modifier interpreter, handling the marshalling between RPC
types and internal formats.
2024-09-19 09:21:37 +02:00
erik 789c6bac8c multi: replace ioutil.WriteFile 2024-04-25 11:23:31 +02:00
András Bánki-Horváth ad5cd9c8bb multi: extend InvoiceDB methods with a context argument (#8066)
* multi: extend InvoiceDB methods with a context argument

This commit adds a context to InvoiceDB's methods. Along this refactor
we also extend InvoiceRegistry methods with contexts where it makes
sense. This change is essential to be able to provide kvdb and sqldb
implementations for InvoiceDB.

* channeldb: restrict invoice tests to only use an InvoiceDB instance

* docs: update release notes for 0.18.0
2023-10-11 13:42:59 +02:00
positiveblue 5ff5225245 multi: break invoice depenency on channeldb
Now that we have the new package `lnd/channeldb/models` we can invert the
depenency between `channeldb` and `invoices`.

- Move all the invoice related types and errors to the
`invoices` package.

- Ensure that all the packages dealing with invoices use the types and
  interfaces defined in the `invoices` package.

- Implement the InvoiceDB interface (defined in `lnd/invoices`) in
  channeldb.

- Add new mock for InterfaceDB.

- `InvoiceRegistery` tests are now in its own subpacakge (they need to
  import both invoices & channeldb). This is temporary until we can
  decouple them.
2023-01-16 07:31:09 -08:00
eugene 0ba67015da rpcserver+invoicesrpc: alias-aware AddInvoice,AddHoldInvoice rpc
AddInvoice,AddHoldInvoice now issue invoices that include our
peer's aliases. Some extra sanity checks are included to ensure we
don't leak our confirmed SCID for a private channel.
2022-07-07 17:10:29 -04:00
Oliver Gugger dfdc2bff8b multi: run gosimports 2022-02-10 11:02:01 +01:00
yyforyongyu df2ecd6bc5 invoices: refactor invoice subscriptions to avoid blocking
This commit fixes a potential blocking when notifying invoice updates.
When a new subscription client is created followed by an immediate
cancel, it's likely the client will be removed from the registry's
map(noop) and then added to its map again. This subscription will then
be kept in registry until lnd is restarted. Another more serious issue
is when multiple subscriptions are made for the same invoice, when the
above case happens, other subscriptions may never send invoice updates
because a previous client has a stopped notification queue that blocks
following notifications.
2021-12-15 02:38:51 +08:00
Olaoluwa Osuntokun d8ce00e016 lnrpc/invoicesrpc: expose new lookup modifier to LookupInvoiceV2 2021-10-28 15:50:17 -07:00
Olaoluwa Osuntokun 8299d632e8 lnrpc/invoicesrpc: add new invoice ref LookupInvoiceV2 method
In this commit, we add a new `LookupInvoiceV2` method attached to the
invoice RPC sub-server. Compared to the existing version, this version
allows an invoice to be looked up by an invoice ref. This enables users
to query an AMP invoice based on a specific _set ID_, so they can get
the information related to the set of cumulative settles to that
invoices.
2021-10-28 15:49:25 -07:00
Oliver Gugger 0b4e03f5fc multi: add golang 1.17 compatible build tags
With go 1.17 a change to the build flags was implemented:
https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md

The formatter now automatically adds the forward-compatible build tag
format and the linter checks for them, so we need to include them in our
code.
2021-09-29 17:31:37 -07:00
Oliver Gugger 9138c8abac multi: rename local and remote chan DBs
As a preparation to not have a local and remote version of the database
around anymore, we rename the variables into what their actual function
is. In case of the RPC server we even directly use the channel graph
instead of the DB instance. This should allow us to extract the channel
graph into its own, separate database (perhaps with better access
characteristics) in the future.
2021-08-04 14:55:50 +02:00
Oliver Gugger dd749fe580 lnrpc: update grpc-gateway library to v2 2021-07-27 13:09:59 +02:00
ErikEk 850dee37ee invoices: return payment address from addholdinvoice 2021-07-19 17:05:03 +02:00
Conner Fromknecht 6a7d3c4b5e lnrpc+rpcserver: thread GenAmpInvoiceFeatures to invoicesrpc 2021-05-10 16:55:17 -07:00
whythat 1adeb41a9d rpcserver+lnrpc: make Subscribe RPCs context aware
This commit makes all the Subscribe RCP's context aware so that they
stop executing when the request context is cancelled.
2021-04-22 07:49:29 +02:00
carla db1d671b1a multi: terminate SubscribeSingleInvoice once completed 2021-04-14 09:19:23 +02:00
Johan T. Halseth 4ea494e8c5 lnrpc: wrap subservers in GrpcHandler
In order to be able to register the subservers with the root grpc server
before we have all dependencies available, we wrap them in an
GrpcHandler struct. This struct will initially hold an empty reference
to the subservers, which allows us to register with the GRPC server, and
later populate and create the subserver instance.
2021-03-11 13:05:23 +01:00
Andras Banki-Horvath dde5750160 invoices+rpc: add missing channel graph to the AddInvoiceConfig
The Graph which is referenced later in the AddInvoice call graph is
unset when adding a hodl invoice. This resulted in a crash.
2021-02-03 11:33:27 +01:00
Olaoluwa Osuntokun 99b0913562 Merge pull request #3672 from breez/invoice-hints
Allow user specify routing hints in private invoice.
2020-11-11 19:57:49 -08:00
Graham Krizek 5aa0d26251 lnrpc+macaroon: skip subserver macaroons on stateless_init
This will prevent the subservers from writing macaroons to disk
when the stateless_init flag is set to true. It accomplishes
this by storing the StatelessInit value in the Macaroon Service.
2020-11-07 11:24:35 +01:00
Roei Erez 4463a4ce17 invoicerpc: Allow user specify routing hints. 2020-11-06 17:54:20 +02:00
yyforyongyu c8a2916d91 lncli: support list/delete on marcaroon IDs 2020-08-14 12:36:21 +08:00
yyforyongyu c0e2513350 lnrpc+rpcserver: support list/delete on marcaroon IDs 2020-08-14 12:33:13 +08:00
Oliver Gugger 558d63718b rpcserver+lnrpc: register REST subservers with root server 2020-06-04 08:50:44 +02:00
Joost Jager d416ed59ea multi: add explicit hodl invoice flag to invoice
Previously it wasn't possible to store a preimage in the invoice
database and signal that a payment should not be settled right away. The
only way to hold a payment was to insert the magic UnknownPreimage value
in the invoice database. This commit introduces a distinct flag to
signal that an invoice is a hold invoice and thereby allows the preimage
to be present in the database already.

Preparation for (key send) hodl invoices for which we already know the
preimage.
2020-06-02 07:34:23 +02:00
Olaoluwa Osuntokun 363caa441a rpc: allow wumbo invoices
In this commit, we remove the restriction surrounding the largest
invoices that we'll allow a user to create. After #3967 has landed,
users will be able to send in _aggregate_ a payment larger than the
current max HTLC size limit in the network. As a result, we can just
treat that value as the system's MTU, and allow users to request
payments it multiples of that MTU value.

A follow up to this PR at a later time will also allow wumbo _channels_.
However, that requires us to tweak the way we scale CSV values, as post
wumbo, there is no true channel size limit, only the
_local_ limit of a given node. We also need to implement a way for nodes
to signal to other nodes their accepted max channel size.
2020-04-09 19:02:08 -07:00
Conner Fromknecht 1367187454 multi: set invoice feature bits using feature manager 2019-12-10 13:09:52 -08:00
Joost Jager fcbf1bc07a invoicesrpc+lnrpc: add msat fields to invoices 2019-11-15 08:59:35 +01:00
Joost Jager 3d7de2ad39 multi: remove dead code 2019-09-10 17:21:59 +02:00
Joost Jager 395e0596c2 invoices: fix synchronization issue with single invoice subscribers
This commit fixes a synchronization issue where a single invoice
subscriber could receive duplicate and/or out of order invoice updates.
2019-08-13 19:02:55 +02:00
Daniel McNally c9afa6469f invoicesrpc: SubcribeSingleInvoiceRequest fix
This fixes a bug where the RHashStr field on the PaymentHash request for
SubscribeSingleInvoice was being ignored. This replaces the PaymentHash
message for the SubscribeSingleInvoice request with a new message called
SubscribeSingleInvoiceRequest that contains only the RHash field.
2019-05-10 22:02:58 -04:00
Joost Jager f450929b65 invoicesrpc: add SettleInvoice 2019-03-15 10:09:23 +01:00
Joost Jager fcdc8f0e83 lnrpc/invoices: add hold invoice rpc 2019-03-15 10:08:58 +01:00
Joost Jager c4263e7061 lntypes: return a value from constructors
Returning pointers proved inconvenient in almost all cases. This commmit
converts the constructors to returning values.
2019-03-15 10:08:38 +01:00
Joost Jager 1b87fbfab2 invoices+htlcswitch+lnrpc: cancel invoice 2019-02-06 07:29:18 +01:00
Johan T. Halseth 3daaa8cf74 lndrpc/invoicesrpc+walletrpc: clean up imports 2019-02-02 15:48:22 +01:00
Joost Jager 70c874be88 invoicesrpc: add SubscribeSingleInvoice rpc 2019-02-01 09:43:17 +01:00
Joost Jager 3545685177 invoicesrpc: create sub server
Sub server implementation is still empty. This is a preparatory
step for adding invoice functionality.
2019-02-01 09:42:35 +01:00