c-lightning determine channel capacity

0

I'm using c-lightning to experiment with sending micropayments backwards and forwards between 2 separate nodes.

One area I am experiencing great difficulty with is being able to generate an invoice and receiving this warning:

"warning_capacity": "No channels have sufficient incoming capacity"

The command that received the warning above was:

$ lightning-cli invoice 1 l1 d1

The peer hash a single connection and a single channel:

$ lightning-cli listpeers
 {
  "peers": [
    {
      "id": "03eb6cac804699e4d941d4d170d088e37e67abc27b39e483fc5b68c423135cc3d4",
      "connected": true,
      "netaddr": [
        "192.168.1.11:9735"
      ],
      "global_features": "",
      "local_features": "8a",
      "globalfeatures": "",
      "localfeatures": "8a",
      "channels": [
        {
          "state": "CHANNELD_NORMAL",
          "scratch_txid": "7c621a81ed27b5e05a3e55acb5928e74f9c111bfa26f7a07660af6613e1a4453",
          "owner": "lightning_channeld",
          "short_channel_id": "1446307:37:0",
          "channel_id": "eb6227c6ff872c09b55897f49d3394dbd129b8839d05a32f6d5f93c510c3199f",
          "funding_txid": "9f19c310c5935f6d2fa3059d83b829d1db94339df49758b5092c87ffc62762eb",
          "msatoshi_to_us": 1599884,
          "msatoshi_to_us_min": 1599884,
          "msatoshi_to_us_max": 1600000,
          "msatoshi_total": 1600000,
          "dust_limit_satoshis": 546,
          "max_htlc_value_in_flight_msat": 18446744073709551615,
          "their_channel_reserve_satoshis": 546,
          "our_channel_reserve_satoshis": 546,
          "spendable_msatoshi": 1053884,
          "htlc_minimum_msat": 0,
          "their_to_self_delay": 6,
          "our_to_self_delay": 6,
          "max_accepted_htlcs": 483,
          "status": [
            "CHANNELD_NORMAL:Reconnected, and reestablished.",
            "CHANNELD_NORMAL:Funding transaction locked. Channel announced."
          ],
          "in_payments_offered": 0,
          "in_msatoshi_offered": 0,
          "in_payments_fulfilled": 0,
          "in_msatoshi_fulfilled": 0,
          "out_payments_offered": 4,
          "out_msatoshi_offered": 116,
          "out_payments_fulfilled": 4,
          "out_msatoshi_fulfilled": 116,
          "htlcs": [
          ]
        }
      ]
    }
  ]

My question is how can I determine what a channel's capacity is? I have made payments of 116 msatoshi from this node. Doesn't that mean I should now have that much incoming capacity to receive payments? Is the maximum incoming capacity of the channel msatoshi_total - msatoshi_to_us?

sipwiz

Posted 2018-12-03T20:00:08.350

Reputation: 685

And here's a good explanation of the channel_reserve_satoshis referred to by Rusty https://medium.com/coinmonks/how-to-spend-all-funds-from-a-lightning-channel-44eded09a6dc.

sipwiz 2018-12-04T18:41:21.493

Answers

3

OK, the three figures you care about here are:

"msatoshi_total": 1600000,
"msatoshi_to_us": 1599884,
"their_channel_reserve_satoshis": 546,

They have 1600000 - 1599884 millisatoshis, ie 116. But they need to keep at least 546 satoshis reserve, ie. 546,000. Until they do, we won't let them spend any.

Hence the warning when you created an invoice: there's no way someone can pay it with the current channel configuration!

Rusty Russell

Posted 2018-12-03T20:00:08.350

Reputation: 66

1Welcome to Bitcoin SE, @Rusty!Pieter Wuille 2018-12-04T02:39:48.533

while the answer is on the spot (as expected if Rusty answers it) I would like to add that the reserve is needed to pay fees in case of a close and / or to have a minimum amount for punishment to deincentivise you for cheating. This amount is usually 1 % of the total capacity.Rene Pickhardt 2018-12-08T18:43:19.277