Skip to main content

Spec protocol tests for lightning network implementations

Project description

lnprototest

a Testsuite for the Lightning Network Protocol

Project Homepage

GitHub Workflow Status (branch)

lnprototest is a set of test helpers written in Python3, designed to make it easy to write new tests when you propose changes to the lightning network protocol, as well as test existing implementations.

Install requirements

To install the necessary dependences

pip3 install poetry
poetry shell
poetry install

Well, now we can run the test

Running test

The simplest way to run is with the "dummy" runner:

make check

Here are some other useful pytest options:

  1. -n8 to run 8-way parallel.
  2. -x to stop on the first failure.
  3. --pdb to enter the debugger on first failure.
  4. --trace to enter the debugger on every test.
  5. -k foo to only run tests with 'foo' in their name.
  6. tests/test_bolt1-01-init.py to only run tests in that file.
  7. tests/test_bolt1-01-init.py::test_init to only run that test.
  8. --log-cli-level={LEVEL_NAME} to enable the logging during the test execution.

Running Against A Real Node.

The more useful way to run is to use an existing implementation. So far, core-lightning is supported. You will need:

  1. bitcoind installed, and in your path.
  2. lightningd compiled with --enable-developer. By default the source directory should be ../lightning relative to this directory, otherwise use export LIGHTNING_SRC=dirname.
  3. Install any python requirements by pip3 install -r lnprototest/clightning/requirements.txt.

Then you can run

make check PYTEST_ARGS='--runner=lnprototest.clightning.Runner'

or directly:

pytest --runner=lnprototest.clightning.Runner

Further Work

If you want to write new tests or new backends, see HACKING.md.

Let's keep the sats flowing!

Rusty.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lnprototest-0.0.7.tar.gz (73.1 kB view details)

Uploaded Source

Built Distribution

lnprototest-0.0.7-py3-none-any.whl (80.3 kB view details)

Uploaded Python 3

File details

Details for the file lnprototest-0.0.7.tar.gz.

File metadata

  • Download URL: lnprototest-0.0.7.tar.gz
  • Upload date:
  • Size: 73.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Darwin/24.3.0

File hashes

Hashes for lnprototest-0.0.7.tar.gz
Algorithm Hash digest
SHA256 b3b1a536e6ca95762b67484270176c7704767aea89410f2c34794a3799b40db7
MD5 cc8b2008e9304c0c37de214f16d747ad
BLAKE2b-256 72f6e342252448da60c2221cedb1342a3c6547163c37b9aa17cdab4d67b47855

See more details on using hashes here.

File details

Details for the file lnprototest-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: lnprototest-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 80.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Darwin/24.3.0

File hashes

Hashes for lnprototest-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 6725435738b8594cb748ea995f978e45b519223f268da5980a549be97ea87335
MD5 3edb581d1b99afa3beb6ba1656cefe8c
BLAKE2b-256 12e470cc01b70156b6b867c44e342dc4024f33664cb023c13e1a757ab26d7c59

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page