nix-bitcoin
nix-bitcoin copied to clipboard
Add PeerSwap
This PR adds peerswap. Peerswap allows you to rebalance channels with your direct peers using submarine swaps on bitcoin and on liquid. It is alpha software so should be used with caution.
I added modules for lnd as well as the clightning plugin.
Let me know if the testcase makes sense. I don't know how to run clightning plugin tests, however running
./run-tests.sh -s "{ services.clightning.enable = true;services.clightning.plugins.peerswap.enable = true;}" container --run c "lightning-cli peerswap-listswaps"
went fine
-
peerswap-liquid-rpcwallet
should probably be renamed topeerswap-liquid-wallet
. -
allowlisted_peers
should be renamed toallowed_peers
. -
Currently, running
peerswap-lnd
and the clightning plugin in parallel fails with:-4:Wallet file verification failed. Failed to create database path '/var/lib/liquidd/liquidv1/wallets/peerswap'. Database already exists.
Should we assign different wallet names to each implementation?
-
Why does
peerswap-lnd
requirelnd
group access? -
When running the clightning plugin with liquid support it exits right after starting. You can check this with:
run-tests.sh -s '{ services.liquidd.enable = true; services.clightning.plugins.peerswap.enable = true; }' container --run c journalctl -u clightning
Output:
lightningd[490]: INFO plugin-peerswap: Liquid swaps enabled lightningd[490]: INFO plugin-peerswap: Killing plugin: exited during normal operation
You can also run a VM and check the logs (
journalctl -u clightning
):run-tests.sh -s '{ services.liquidd.enable = true; services.clightning.plugins.peerswap.enable = true; }' vm
-
Does it make sense to enable liquid peerswaps by default when liquid is enabled? Could this be too intrusive, given that a wallet is created? Or do you expect that most liquid users want to enable liquid peerswap support?
concept ACK for adding peerswap
Fixups
Randomly noticed that peerswap isn't mentioned in the README.
Does it make sense to enable liquid peerswaps by default when liquid is enabled?
A downside with peerswap is that it has full access to all liquidd wallets, which is something that we should mention somewhere and allow the user to explicitly opt-in to (similarly to how we note this for joinmarket in the example config).
By the way, would be good to get rid of the "DO NOT USE ON MAINNET YET" warning in the peerswap README before we merge this.
concept ACK for adding peerswap
Should we assign different wallet names to each implementation?
Yes
Does it make sense to enable liquid peerswaps by default when liquid is enabled? Could this be too intrusive, given that a wallet is created? Or do you expect that most liquid users want to enable liquid peerswap support?
Too intrusive in my opinion, especially because this is alpha software and it requires full access to all liquidd wallets, as @jonasnick mentioned above.