Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChannelManager::list_channels always returns ChannelDetails with 0 in/outbound capacity. #654

Closed
joemphilips opened this issue Jul 6, 2020 · 2 comments

Comments

@joemphilips
Copy link
Contributor

joemphilips commented Jul 6, 2020

Right now, I'm trying to open/close channel against other nodes.
it still has some issues with c-lightning (see e.g. ElementsProject/lightning#3819
ElementsProject/lightning#3815), but it seems working fine for lnd.

There is one problem before going to next step (i.e. payment).
The ChannelDetails returned from ChannelManager::list_channels
always have 0 value for both outbound_capacity_msat and inbound_capacity_msat field.

I have checked by println debug that this is not caused by serialization bug in FFI boundary.

Step for reproduction

git clone --recursive https://github.com/joemphilips/NRustLightning
git checkout payment_integration_tests
cd tests/NRustLightning.Server.Tests
source env.sh
  && docker-compose up --build

./cliutils/connect-all.sh && ./cliutils/prepare_funds.sh && ./cliutils/prepare_tx_for_fee.sh && ./cliutils/open_outbound_channels.sh

Response returned from lnd-cli listchannels is

{
    "channels": [
        {
            "active": true,
            "remote_pubkey": "02bbbfe3b521028567a09785a06afc9a49dab39cefd654041987538f21b6de8e66",
            "channel_point": "66e0979e40348918ecf1ae0492e124d7011a67a67bb2303297f6a3df8863a8df:0",
            "chan_id": "352943232581632",
            "capacity": "100000",
            "local_balance": "1",
            "remote_balance": "96379",
            "commit_fee": "3621",
            "commit_weight": "552",
            "fee_per_kw": "5000",
            "unsettled_balance": "0",
            "total_satoshis_sent": "0",
            "total_satoshis_received": "0",
            "num_updates": "0",
            "pending_htlcs": [
            ],
            "csv_delay": 144,
            "private": false,
            "initiator": false,
            "chan_status_flags": "ChanStatusDefault",
            "local_chan_reserve_sat": "1000",
            "remote_chan_reserve_sat": "1000",
            "static_remote_key": true,
            "lifetime": "175",
            "uptime": "175",
            "close_address": ""
        }
    ]
}

Which is sane.

And the channel details I got from my REST endpoint is

{
  "details": [
    {
      "channelId": "dfa86388dfa3f6973230b27ba6671a01d724e19204aef1ec188934409e97e066",
      "shortChannelId": 352943232581632,
      "remoteNetworkId": "02b76b5e7cf84a726dde5c6f88a6dad671ec5a4153a571749269aaeeeb0d874d5e",
      "counterPartyFeatures": {
        "bitArray": "000000101010001010100001",
        "hexBytes": "0x02a2a1",
        "prettyPrint": "basic_mpp is optional. gossip_queries is optional. gossip_queries_ex is non supported. initial_routing_sync is non supported. option_data_loss_protect is mandatory. option_static_remotekey is optional. option_support_large_channel is non supported. option_upfront_shutdown_script is optional. payment_secret is optional. var_onion_optin is optional. "
      },
      "channelValueSatoshis": 100000,
      "userId": 16922229370071513000,
      "outboundCapacityMSat": 0,
      "inboundCapacityMSat": 0,
      "isLive": true
    }
  ]
}

I can go futher but before that I wanted to make sure that I'm not missing anything, any clue?

@joemphilips
Copy link
Contributor Author

joemphilips commented Jul 6, 2020

Oh, ah nevermind. I just realized that endian for ChannelId is reversed... I think this is the issue of my serialization code.
I realized that If that is the case, I could not be able to open the channel in the first place. I will probably investigate the detail later.

@joemphilips
Copy link
Contributor Author

Ah, it was super easy mistake in my side... I was using different nodeid in PeerManager and ChannelManager.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant