Files
palladum-lightning/TESTING_PALLADIUM.md
Davide Grilli ee8dccdd4d Add Palladium testing infrastructure and local regtest setup
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
2026-02-20 14:10:53 +01:00

107 lines
3.0 KiB
Markdown

# 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
1. **Palladium Core**: You must have `palladiumd` and `palladium-cli` compiled.
2. **Palladium Lightning**: Ensure you have successfully compiled this repository (`make`).
3. **Dependencies**: Make sure you have `bash` and 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:
```bash
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:
```bash
export PALLADIUM_BIN=/path/to/palladiumcore/src
```
Then, initialize the test environment using the startup script:
```bash
# 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.
```bash
bt-cli getblockchaininfo
```
- **`l1-cli`, `l2-cli`, `l3-cli`**: Connects to the respective Lightning nodes.
```bash
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:
```bash
fund_nodes
```
This will:
1. Generate some Palladium blocks to fund the default wallet.
2. Connect `l1` to `l2`, and `l2` to `l3`.
3. Fund the channels automatically and mine the necessary confirmation blocks.
You can verify the channels by running:
```bash
l1-cli listchannels
```
## 4. Teardown
When you are finished testing, cleanly shut down the environment and remove the temporary data.
```bash
# 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:
1. Install the testing dependencies:
```bash
pip3 install -r contrib/pyln-testing/requirements.txt
```
2. Run pytest from the root of the repository:
```bash
pytest tests/
```
*(Note: Be sure your environment variables correctly point to your Palladium binaries if they are not system-wide installed).*