bitcoin-dev-project / sim-ln

Payment activity generator for the lightning network
MIT License
63 stars 28 forks source link

Unable to use CLN node as destination in defined activity #208

Open bjohnson5 opened 1 day ago

bjohnson5 commented 1 day ago

Describe the bug When I attempt to use a CLN node as a destination in the defined activity, the simulation does not start and gives the error:

ValidationError("Destination node does not support keysend, cln-0000(0287eb...c97d33)"

However, CLN appears to have keysend enabled and it can send keysend payments when it is used as the source node in the defined activity.

To Reproduce

Configure a simple defined activity with an LND node as the source and a CLN node as the destination.

Possible Solution I believe this is due to the feature flags not being parsed correctly when creating a CLN node in SimLN.

In the get_node_info function in cln.rs the feature bits are reversed before calling NodeFeatures::from_le_bytes

        if let Some(node) = nodes.pop() {
            Ok(NodeInfo {
                pubkey: *node_id,
                alias: node.alias.unwrap_or(String::new()),
                features: node
                    .features
                    .clone()
                    .map_or(NodeFeatures::empty(), |mut f| {
                        // We need to reverse this given it has the CLN wire encoding which is BE
                        f.reverse();
                        NodeFeatures::from_le_bytes(f)
                    }),
            })

But in the new function for ClnNode the feature bits are passed directly into NodeFeatures::from_le_bytes.

        let features = if let Some(features) = our_features {
            NodeFeatures::from_le_bytes(features.node)
        } else {
            NodeFeatures::empty()
        };

        Ok(Self {
            client,
            info: NodeInfo {
                pubkey,
                features,
                alias,
            },
        })
bjohnson5 commented 1 day ago

@carlaKC have you tried using a default CLN node as a destination? Still wondering if this has something to do with my config.