Lightning: Can't generate invoice with only private channels

Created on 22 May 2020  Â·  13Comments  Â·  Source: ElementsProject/lightning

Issue and Steps to Reproduce

  1. Create node with only private outgoing channels
  2. Spend a bunch of sats
  3. Try to generate an invoice with lightning-cli -k invoice msatoshi=50000 description=test label=test exposeprivatechannels=true
  4. Get "warning_capacity": "No channels"

getinfo output

{
   "id": "#",
   "alias": "#",
   "color": "#",
   "num_peers": 3,
   "num_pending_channels": 0,
   "num_active_channels": 3,
   "num_inactive_channels": 0,
   "address": [],
   "binding": [
      {
         "type": "ipv4",
         "address": "127.0.0.1",
         "port": 9735
      }
   ],
   "version": "v0.8.2",
   "blockheight": 631295,
   "network": "bitcoin",
   "msatoshi_fees_collected": 0,
   "fees_collected_msat": "0msat",
   "lightning-dir": "/var/lib/clightning/bitcoin"
}
question needinfo

All 13 comments

Could be that your channel's incoming capacity (i.e., capacity owned by the remote end minus its reserve value) is below the amount of the invoice.

If you have created a 1'000'000 satoshi outgoing channel, and then send 55'000 satoshi through it you have the following balances: 945'000 / 55'000. The remote reserve usually is 1%, so at least 10'000 satoshi need to stay at the remote end.

So while the remote end has 55'000 > 50'000 satoshi, it cannot send all of them, since 10'000 need to stay at their end, making the total incoming capacity "only" 45'000 satoshis, hence the warning.

Hmm, I have almost 5,000,000 sat incoming capacity on some channels. I opened a new, smaller private channel for testing, with which I can now generate invoices, up to its incoming capacity (shown in spark-wallet). However, I can still not generate 4,000,000 sat invoices with the older channels, even though their capacity is more than enough.

All of my old channels, however, have almost no outgoing capacity. Could this have something to do with it?

Unlikely, I should also point out that this is just a warning, you should still get a valid invoice. We just added that to avoid complaints about being unable to receive and not have an indication as to what the issue might be. The heuristic is not the most stable though, and we get a number of false positives.

I'm getting a valid invoice, without route hints though. Can one manually add a route hint?

Hmmm. If all channels are unpublished (please do not use the term "private" for unpublished channels, as unpublished channels represent a privacy tradeoff (you are informing your direct peer that you are very almost definitely the final recipient/sender whenever you receive/send via an unpublished channel, but you gain the bonus that the onchain funding UTXO is not revealed as a funding outpoint until it is closed) and are not perfectly better for privacy than published channels), then an invoice without any routehints at all is worthless, as it cannot be paid.

On the other hand, even if at the time the invoice is created all channels have insufficient capacity, the node operator could arrange to have channels drained later.

So how about this:

  • If all channels are unpublished, and none of the channels have sufficient incoming capacity:

    • Sort channels by incoming capacity and see if a subset of channels have some sufficient incoming capacity that a theoretical perfect MPP might be able to pay it, then put all the selected channels as routehints and warn with "payer must have perfect MPP (which might not exist yet) to pay".

    • Otherwise, there is simply no way to get paid without the operator doing something first, and we should error.

How about that instead?

Can one manually add a route hint?

Currently, no.

If you try to force a route hint, you have to first arrange for incoming capacity on the channel you are forcing into the route hint. And our pay command does not really give that kind of fine-grained control that we can say "take money from this channel only". So you have to go fix your channel capacities beforehand. Possibly, what we can do is what I suggested above: try to get incoming capacity in total above the invoice amount, and hope that somebody has invented a decent MPP that can actually pay it.

This should be fixed now with the new MPP invoices, is this still an issue @nixbitcoin ?

Still an issue. For some reason my older private channels with abundant incoming balance aren't included in route hints. Any way I can reinitialize the channels or make them public to bring them into scope for the invoice command?

When using unpublished channels, we do a round-robin scheme for the incoming channels rather than leak information on sizes by preferring larger incoming unpublished channels (which is the default when using published channels). It could be that your older channels with lots of incoming capacity are just on the tail end of the round-robin scheme. Can you check decodepay of generated invoices and try large numbers of invoice commands? How many channels do you have?

Can you check decodepay of generated invoices and try large numbers of invoice commands?

I did exactly that, for some reason they're not in scope for invoice generation.

How many channels do you have?

4 active channels, 2 older private channels that for some reason can't be used for invoice generation.

Hmmm. Needs more info. Are you willing to show listpeers result? getinfo?

Don't wanna doxx myself. Maybe it's better to run public channels anyway.

@nixbitcoin Is there any exact way to reproduce it? The reproduction script/steps could be private enough…

Could be the same issue I'm facing in #4386 (those are all public, though). I can't seem to make it include more than a single channel in route hints

Was this page helpful?
0 / 5 - 0 ratings

Related issues

agilob picture agilob  Â·  4Comments

gallizoltan picture gallizoltan  Â·  3Comments

brunoaduarte picture brunoaduarte  Â·  5Comments

mloop1 picture mloop1  Â·  4Comments

brunoaduarte picture brunoaduarte  Â·  4Comments