The python test script below (using the pyln-testing library) opens a channel between l1 and l2, and then the funder (l1) pays half of the channel's capacity to l2. After this payment 'l2' wants to make a smaller payment to l1, but this payment fails for reasons I will explain below the script.

Test script

from pyln.testing.fixtures import *  # noqa: F401, F403
from pyln.testing.utils import wait_for, DEVELOPER
import unittest

@unittest.skipIf(not DEVELOPER, "gossip is too slow if we're not in developer mode")
def test_two_way_payment(node_factory):
    """Send a payment to and fro
    l1 ---- l2
    opts = [{},{}]
    l1, l2 = node_factory.get_nodes(2, opts=opts)

    l1.openchannel(l2, capacity=capacity)
    # Now wait for gossip to settle and l1 to learn the topology
    wait_for(lambda: len(l1.rpc.listchannels()['channels']) == 2)

     # Get all channels balanced (by paying money to the other node)
    l1.pay(l2, capacity // 2)

    print("LISTPEERS L2: {}\n".format(l2.rpc.listpeers()))

    l2.pay(l1, capacity // 20)

The script above fails with the error below


Fail: pyln.client.lightning.RpcError: RPC call failed: method: waitsendpay, payload: {'payment_hash': '6d1281627828720bd86cb2815f222a8c0106545d7d4f972e5ec5324133163224'}, error: {'code': 204, 'message': 'failed: WIRE_TEMPORARY_CHANNEL_FAILURE (WIRE_TEMPORARY_CHANNEL_FAILURE: Capacity exceeded - HTLC fee: 7964sat)', 'data': {'id': 1, 'payment_hash': '6d1281627828720bd86cb2815f222a8c0106545d7d4f972e5ec5324133163224', 'destination': '0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518', 'msatoshi': 50000, 'amount_msat': 50000msat, 'msatoshi_sent': 50000, 'amount_sent_msat': 50000msat, 'created_at': 1623829593, 'status': 'failed', 'erring_index': 0, 'failcode': 4103, 'failcodename': 'WIRE_TEMPORARY_CHANNEL_FAILURE', 'erring_node': '022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59', 'erring_channel': '1x1x1', 'erring_direction': 0}}


If I lift some information out of the listpeers rpc call for l2 I can understand why the payment wouldn't work:

'msatoshi_to_us': 500000
'spendable_msatoshi': 0

What I don't understand is why 'spendable_msatoshi' would be zero. It can't be because of the channel reserve. I don't think it can be because of enormously overestimating the on-chain fees (in case of a forced close) because the l2 isn't the funder.

What am I missing/not understanding here?

1 Answer 1


You opened a 1 million Satoshi channel and send 500 sats to the other side. The protocol requires a 1%channel reserve kept on both sides for the penalty mechanism to always have enough collateral. This one percent is ignored initially if you never had that much balance (e. G. On new channels) but is the reason why you can't send sats unless you met the 1% threshold.

Send another 9501 sats (9501000msats) and you should see that you can spend 1 satoshi

  • I mixed up sats and msats. I meant to balance the channel 50/50, but openchannel uses sats and pay uses msats.
    – gijswijs
    Jun 16, 2021 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.