This commit finalizes the integration of Palladium Lightning with the Palladium Core backend, making it trivial for developers to spin up and test a local regtest network. Key changes: - Created [TESTING_PALLADIUM.md](cci:7://file:///home/davide/lightning-plm/TESTING_PALLADIUM.md:0:0-0:0) with comprehensive regtest instructions. - Linked the new testing guide in the main [README.md](cci:7://file:///home/davide/lightning-plm/README.md:0:0-0:0). - Ignored `/palladium-bin/` in `.gitignore` to allow developers to drop backend binaries locally without accidentally committing them. - Patched `contrib/startup_regtest.sh` to automatically detect and use these local `palladiumd`/`palladium-cli` binaries if present, removing the strict need to manually export environment variables. - Fixed a false-positive timeout error in `startup_regtest.sh` when parsing the absent `clnrest` plugin logs
3.0 KiB
Testing Palladium Lightning
This guide explains how to test the Palladium Lightning (lightning-plm) integration with Palladium Core (palladiumcore) on your local machine using a Regtest environment.
Prerequisites
- Palladium Core: You must have
palladiumdandpalladium-clicompiled. - Palladium Lightning: Ensure you have successfully compiled this repository (
make). - Dependencies: Make sure you have
bashand standard Unix utilities installed.
1. Regtest Setup
The easiest way to test channels and interactions is by using the provided startup_regtest.sh script. This script automatically spins up a local Palladium Regtest network alongside 3 Lightning nodes.
First, you need to make the Palladium binaries accessible to the test scripts. The simplest method is to copy them directly into a palladium-bin directory in the root of the repository:
mkdir -p palladium-bin
cp /path/to/palladiumcore/src/palladiumd palladium-bin/
cp /path/to/palladiumcore/src/palladium-cli palladium-bin/
(Note: The palladium-bin directory is correctly ignored by git, so your local binaries won't be pushed).
Alternatively, you can skip copying the binaries and specify their path manually using an environment variable before running the script:
export PALLADIUM_BIN=/path/to/palladiumcore/src
Then, initialize the test environment using the startup script:
# Sourcing the script loads useful aliases into your terminal
source contrib/startup_regtest.sh
# Start the cluster with 3 nodes
start_ln 3
2. Using the Aliases
Once the cluster is running, the script creates several handy aliases to interact with the nodes easily.
-
bt-cli: Connects to the local Palladium backend.bt-cli getblockchaininfo -
l1-cli,l2-cli,l3-cli: Connects to the respective Lightning nodes.l1-cli getinfo l2-cli newaddr
3. Funding and Connecting Nodes
To test the complete lifecycle of a Lightning channel, you can automatically fund the nodes and connect them together with a single command:
fund_nodes
This will:
- Generate some Palladium blocks to fund the default wallet.
- Connect
l1tol2, andl2tol3. - Fund the channels automatically and mine the necessary confirmation blocks.
You can verify the channels by running:
l1-cli listchannels
4. Teardown
When you are finished testing, cleanly shut down the environment and remove the temporary data.
# Stop the Palladium and Lightning daemons
stop_ln
# Clean up the temporary node directories in /tmp
destroy_ln
Running Python Integration Tests
If you want to run the automated Python test suite against the Palladium backend:
-
Install the testing dependencies:
pip3 install -r contrib/pyln-testing/requirements.txt -
Run pytest from the root of the repository:
pytest tests/
(Note: Be sure your environment variables correctly point to your Palladium binaries if they are not system-wide installed).