update readme with new plugin wrapper

This commit is contained in:
Jesse de Wit
2022-12-23 19:03:44 +01:00
parent 6e673d2be4
commit 5a419fbff2

View File

@@ -14,32 +14,29 @@ This is a simple example of an lspd that works with an [lnd](https://github.com/
### Running lspd on LND
1. Run LND with the following options set:
- `--protocol.zero-conf`: for being able to open zero conf channels
- `--protocol.option-scid-alias`: required for zero conf channels
- `--protocol.zero-conf`: for being able to open zero conf channels
- `--protocol.option-scid-alias`: required for zero conf channels
- `--requireinterceptor`: to make sure all htlcs are intercepted by lspd
- `--bitcoin.chanreservescript="0"` to allow the client to have zero reserve on their side
- `--bitcoin.chanreservescript="0"` to allow the client to have zero reserve on their side
1. Run lspd
### Running lspd on CLN
lspd on core lightning is run as a plugin. In order to load the environment veriables in the plugin runtime, they either have to be set on the machine, or the plugin should be started with a shell script:
In order to run lspd on top of CLN, you need to run the lspd process and run cln with the provided cln plugin.
The cln plugin (go build -o lspd_plugin cln_plugin/cmd) is best started with a bash script to pass environment variables (note this LISTEN_ADDRESS is the listen address for communication between lspd and the plugin, this is not the listen address mentioned in the 'final step')
```bash
#!/bin/bash
export TOKEN=<TOKEN>
export LSPD_PRIVATE_KEY=<LSPD PRIVATE KEY>
export DATABASE_URL=<DATABASE_URL>
export RUN_CLN=true
# Etc. for all env variables in sample.env
/path/to/lspd
export LISTEN_ADDRESS=<listen address>
/path/to/lspd_plugin
```
Run cln with the following options set:
- `--plugin=/path/to/shell/script.sh`: to use lspd as plugin
- `--max-concurrent-htlcs=30`: In order to use zero reserve channels on the client side, (local max_accepted_htlcs + remote max_accepted_htlcs + 2) * dust limit must be lower than the channel capacity. Reduce max-concurrent-htlcs or increase channel capacity accordingly.
- `--dev-allowdustreserve=true`: In order to allow zero reserve on the client side, you'll need to enable developer mode on cln (`./configure --enable-developer`)
1. Run cln with the following options set:
- `--plugin=/path/to/shell/script.sh`: to use lspd as plugin
- `--max-concurrent-htlcs=30`: In order to use zero reserve channels on the client side, (local max_accepted_htlcs + remote max_accepted_htlcs + 2) * dust limit must be lower than the channel capacity. Reduce max-concurrent-htlcs or increase channel capacity accordingly.
- `--dev-allowdustreserve=true`: In order to allow zero reserve on the client side, you'll need to enable developer mode on cln (`./configure --enable-developer`)
1. Run lspd
### Final step
1. Share with Breez the TOKEN and the LISTEN_ADDRESS you've defined (send to contact@breez.technology)
@@ -64,15 +61,17 @@ In order to run the integration tests, you need:
- lnd v0.15.3 breez client version https://github.com/breez/lnd/commit/e1570b327b5de52d03817ad516d0bdfa71797c64
- bitcoind (tested with v23.0)
- bitcoin-cli (tested with v23.0)
- build of lspd
- build of lspd (go build .)
- build of lspd cln plugin (go build -o lspd_plugin cln_plugin/cmd)
To run the integration tests, run the following command from the lspd root directory (replacing the appropriate paths).
```
go test -v ./itest \
go test -timeout 20m -v ./itest \
--lightningdexec /full/path/to/lightningd \
--lndexec /full/path/to/lnd \
--lndmobileexec /full/path/to/lnd \
--clnpluginexec /full/path/to/lspd_plugin \
--lspdexec /full/path/to/lspd \
--lspdmigrationsdir /full/path/to/lspd/postgresql/migrations
```
@@ -81,6 +80,7 @@ go test -v ./itest \
- Required: `--lndexec` Full path to LSP LND executable. Defaults to `lnd` in `$PATH`.
- Required: `--lndmobileexec` Full path to Breez mobile client LND executable. No default.
- Required: `--lspdexec` Full path to `lspd` executable to test. Defaults to `lspd` in `$PATH`.
- Required: `--clnpluginexec` Full path to the lspd cln plugin executable. No default.
- Required: `--lspdmigrationsdir` Path to directory containing postgres migrations for lspd. (Should be `./postgresql/migrations`)
- Recommended: `--bitcoindexec` Full path to `bitcoind`. Defaults to `bitcoind` in `$PATH`.
- Recommended: `--bitcoincliexec` Full path to `bitcoin-cli`. Defaults to `bitcoin-cli` in `$PATH`.
@@ -88,3 +88,14 @@ go test -v ./itest \
- Optional: `--preservelogs` persists only the logs in the testing directory.
- Optional: `--preservestate` preserves all artifacts from the lightning nodes, miners, postgres container and startup scripts.
- Optional: `--dumplogs` dumps all logs to the console after a test is complete.
Unfortunately the tests cannot be cancelled with CTRL+C without having to clean
up some artefacts. Here's where to look:
- lspd process
- lightningd process
- lnd process
- bitcoind process
- docker container for postgres with default name
It may be a good idea to clean your testdir every once in a while if you're
using the `preservelogs` or `preservestate` flags.