Crypto currency

pyln.testing channel’s spendable_msatoshi remains 0 in the direction towards the funder, regardless of balance

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), capacity // 2)

    print("LISTPEERS L2: {}n".format(l2.rpc.listpeers())), 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?

Most Related Links :
Business News Governmental News Finance News

Source link

Back to top button