Skip to content

Creating a channel with user_channel_id = 1 and channel_value_satoshis = 1000000 results in InvalidChildNumber panic #1947

Closed
@MaxFangX

Description

@MaxFangX

To reproduce

Call ChannelManager::create_channel with user_channel_id = 1 and channel_value_satoshis = 1000000 using version 0.0.113.

Debugging information

Stack trace (line numbers correspond to code as of 0.0.113 release):

thread 'whitebox::payments::user_pays_lsp' panicked at 'key space exhausted: InvalidChildNumber(2665186401)', /Users/fang/lexe/dev/ldk/lightning/src/chain/keysinterface.rs:1054:125
stack backtrace:
   0: rust_begin_unwind
             at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/core/src/panicking.rs:65:14
   2: core::result::unwrap_failed
             at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/core/src/result.rs:1791:5
   3: core::result::Result<T,E>::expect
             at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/core/src/result.rs:1070:23
   4: lightning::chain::keysinterface::KeysManager::derive_channel_keys
             at /Users/fang/lexe/dev/ldk/lightning/src/chain/keysinterface.rs:1054:72
   5: <lightning::chain::keysinterface::KeysManager as lightning::chain::keysinterface::KeysInterface>::derive_channel_signer
             at /Users/fang/lexe/dev/ldk/lightning/src/chain/keysinterface.rs:1274:3
   6: lightning::ln::channel::Channel<Signer>::new_outbound
             at /Users/fang/lexe/dev/ldk/lightning/src/ln/channel.rs:918:23
   7: lightning::ln::channelmanager::ChannelManager<M,T,K,F,L>::create_channel
             at /Users/fang/lexe/dev/ldk/lightning/src/ln/channelmanager.rs:1703:12
   8: lexe_ln::channel::open_channel::{{closure}}
             at /Users/fang/lexe/dev/lexe/public/lexe-ln/src/channel.rs:41:5
...

Tracing the data flow from Channel::new_outbound:

In channel.rs:
lightning/src/ln/channel.rs:917 &channel_value_satoshis = 1000000
lightning/src/ln/channel.rs:917 &user_id = 1
lightning/src/ln/channel.rs:917 &channel_keys_id = [ 0, 0, 0, 0, 158, 219, 132, 97, 69, 212, 64, 34, 221, 63, 215, 231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ]

In keysinterface.rs:
ightning/src/chain/keysinterface.rs:1047 params = [ 0, 0, 0, 0, 158, 219, 132, 97, 69, 212, 64, 34, 221, 63, 215, 231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ]
lightning/src/chain/keysinterface.rs:1047 &chan_id = 2665186401

Which is not in the range of [0, 2^31 - 1], returning InvalidChildNumber(2665186401), which LDK .expect()s on with the "key space exhausted" message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions