Skip to content

Add CLN ln node to the environment#51

Merged
vnprc merged 4 commits intovnprc:masterfrom
optout21:ln-node
Jun 12, 2025
Merged

Add CLN ln node to the environment#51
vnprc merged 4 commits intovnprc:masterfrom
optout21:ln-node

Conversation

@optout21
Copy link
Contributor

@optout21 optout21 commented Jun 11, 2025

Add CLN process to the devenv processes

  • Stock CLN
  • Taken from pkgs.clightning nix package
  • devenv had to be updated, for CLN 25.0, as v 24.0 does not know testnet4
  • connects to bitcoind

Partly fixes #50 .

Copy link
Owner

@vnprc vnprc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great start! Thank you for working on this.

The cln node dies on startup when it fails to connect to the bitcoind node. I can think of two causes:

  1. Double check the port. You may need to add a new entry to the config/miner.toml file. This is a global config file that keeps track of settings shared across roles. There's a miner.toml and a pool.toml to distinguish between the poolside services and the minerside services. Check this diagram: https://hashpool.dev/images/diagrams/process-architecture.png. Lightning is tightly integrated with the mint so it goes on the pool side.

  2. If that doesn't get it working you may need to add a polling loop to force cln to wait for bitcoind to come up. See the polling loops in other processes for an example:

    pool = {
      exec = withLogging ''
        echo "Waiting for Mint..."
        while ! nc -z localhost ${toString poolConfig.mint.port}; do
          sleep 1
        done
        echo "Mint is up. Starting Local Pool..."
        cargo -C roles/pool -Z unstable-options run -- \
          -c ${config.devenv.root}/roles/pool/config-examples/pool-config-local-tp-example.toml \
          -g ${config.devenv.root}/config/pool.toml
      '' "pool.log";
    };

@optout21
Copy link
Contributor Author

I had it running all right several times, so it's no a port issue. The polling may be the cause. I haven't experienced it, but the bahavior may also depend the exact state of the processes.

@optout21
Copy link
Contributor Author

Added polling on bitcoind port

@optout21
Copy link
Contributor Author

Changed to 'regtest' (instead of 'testnet4'), rebased to current master.

@vnprc vnprc merged commit c679c74 into vnprc:master Jun 12, 2025
@vnprc
Copy link
Owner

vnprc commented Jun 12, 2025

Nice work @optout21! 💪

This was referenced Jun 17, 2025
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

Successfully merging this pull request may close these issues.

Add a lightning node

2 participants

Comments