Utility to run a regtest Lightningd process, useful in integration testing environment.
When the auto-download feature is selected by activating one of the version feature, such as v23.05.2
for lightning core v23.05.2, starting a regtest node is as simple as that:
// the download feature is enabled whenever a specific version is enabled, for example `v23.05.2`
#[cfg(feature = "download")]
{
use clightningrpc::LightningRPC;
let lightningd = lightningd::LightningD::from_downloaded().unwrap();
assert_eq!(0, lightningd.client.get_info().unwrap().blocks);
}
The build script will automatically download the lightning core version v23.05.2 from lightning core,
verify the hashes and place it in the build directory for this crate. If you wish to download from an
alternate location, for example locally for CI, use the LIGHTNINGD_DOWNLOAD_ENDPOINT
env var.
When you don't use the auto-download feature you have the following options:
- have
lightning
executable in thePATH
- provide the
lightning
executable via theLIGHTNINGD_EXEC
env var
use clightningrpc::LightningRPC;
if let Ok(exe_path) = lightningd::exe_path() {
let lightningd = lightningd::LightningD::new(exe_path).unwrap();
assert_eq!(0, lightningd.client.get_info().unwrap().blocks);
}
Startup options could be configured via the [Conf
] struct using [LightningD::with_conf
] or
[LightningD::from_downloaded_with_conf
]
Binaries are fetched from lightning repo. Support only the following OS/platform:
- Fedora 28 on amd64
- Ubuntu 18.04 on amd64
- Ubuntu 20.04 on amd64
- Ubuntu 22.04 on amd64
If you just have a lightningd
binary, you could use it by overwriting the path as:
export LIGHTNINGD_EXE=/usr/bin/lightningd
Clightningd
is inspired by amazing work of [RCasatta]https://github.com/RCasatta) for the bitcoind and elementsd library tools.