Skip to content

Add an option to subscribe to every Hold Invoice at once #3120

@sergioabril

Description

@sergioabril

Background

There is no easy way to get Hold Invoice events with one rpc subscription. You have to track them individually, and whenever you start tracking a bunch of them, it doesn't make sense keeping so many rpc subscriptions open, when you could just subscribe once and get all the events there (Just like it happens with regular invoices). This could be a problem for any service that could want to provide Hold Invoices as a solution for their users, and needed to track lots of them at once.

Your environment

  • Lnd 0.6.1
  • (Any environment or setup)

Steps to reproduce

  1. Subscribe to subscribeInvoices

  2. You will start getting standard events for invoices (even for hold invoices), such as OPEN and SETTLE, but not those advanced events used on Hold specific ones, such as ACCEPT or CANCEL.

  3. You could then try subscribing to SubscribeSingleInvoice using the Sub-Server Invoices, but you should do that for each of the Hold invoices you are tracking.

Problem

Whenever you are tracking a bunch of hold invoices, doesn't make sense to subscribe to each of them individually.

Possible solutions

  1. One option could be including an advanced SubscribeInvoices on the invoicesrpc Sub-Server, that gets every STATE change for every invoice. I'm not sure if it's possible to filter it to get Hold-Invoices-only here, but if it's not, then could be used as an advanced replacement of the regular SubscribeInvoices we already have.

  2. Other option might be including Hold Invoice events on the regular subscribeInvoices rpc call. To avoid the hassle of receiving too many updates, it could be an optional parameter whenever you subscribe, set to false by default.

I'm not sure how this works under the hood, but I guess that maybe you would be getting all the state events for every invoice, not just for hold ones, and that's why you haven't included it as an option yet. If that's the case, and is not possible to filter out invoices by its kind before firing the events, then at least would be great to have a "get all the states for every invoice" as an advanced option (whether option 1 or option 2)

Of course, would be great to have a subscribeHoldInvoices on the sub-server invoices, that gets every STATE event, but for hold invoices only

Metadata

Metadata

Assignees

Labels

P2should be fixed if one has timeenhancementImprovements to existing features / behaviourfeature requestRequests for new featurespaymentsRelated to invoices/paymentsrpcRelated to the RPC interface

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions