Added a test for splicing out that exposed some behavior and code glitches that are addressed in this commit. Added test for splice gossip. Also added documentation for how to do a splice out. ChangeLog-Fixed: Added docs, testing, and some fixes related to splicing out, insufficent balance handling, and restarting during a splice.
3.4 KiB
lightning-splice_init -- Command to initiate a channel to a peer
SYNOPSIS
(WARNING: experimental-splicing only)
splice_init channel_id relative_amount [initalpsbt] [feerate_per_kw] [force_feerate]
DESCRIPTION
splice_init
is a low level RPC command which initiates a channel splice for a
given channel specified by channel_id
.
channel_id is the channel id of the channel to be spliced.
relative_amount is a positive or negative amount of satoshis to add or subtract from the channel.
initalpsbt is the (optional) base 64 encoded PSBT to begin with. If not specified, one will be generated automatically.
feerate_per_kw is the miner fee we promise our peer to pay for our side of
the splice transaction. It is calculated by feerate_per_kw
*
our_bytes_in_splice_tx / 1000.
force_feerate is a boolean flag. By default splices will fail if the fee
provided looks too high. This is to protect against accidentally setting your
fee higher than intended. Set force_feerate
to true to skip this saftey check.
Note you may need to add a double dash (--) after splice_init if using a negative relative_amount so it is not interpretted as a command modifier. For example:
lightning-cli splice_init -- $CHANNEL_ID -100000
Here is an example set of splice commands that will splice in 100,000 sats to
the first channel that comes out of listpeerchannels
. The example assumes
you already have at least one confirmed channel.
RESULT=$(lightning-cli listpeerchannels);
CHANNEL_ID=$(echo $RESULT| jq -r ".channels[0].channel_id");
echo $RESULT;
RESULT=$(lightning-cli fundpsbt -k satoshi=100000sat feerate=urgent startweight=800 excess_as_change=true);
INITIALPSBT=$(echo $RESULT | jq -r ".psbt");
echo $RESULT;
RESULT=$(lightning-cli splice_init $CHANNEL_ID 100000 $INITIALPSBT);
PSBT=$(echo $RESULT | jq -r ".psbt");
echo $RESULT;
RESULT=$(lightning-cli splice_update $CHANNEL_ID $PSBT);
PSBT=$(echo $RESULT | jq -r ".psbt");
echo $RESULT;
RESULT=$(lightning-cli signpsbt -k psbt="$PSBT");
PSBT=$(echo $RESULT | jq -r ".signed_psbt");
echo $RESULT;
lightning-cli splice_signed $CHANNEL_ID $PSBT
Here is an example set of splice commands that will splice out 100,000 sats from
first channel that comes out of listpeerchannels
. The example assumes
you already have at least one confirmed channel.
RESULT=$(lightning-cli listpeerchannels);
CHANNEL_ID=$(echo $RESULT| jq -r ".channels[0].channel_id");
echo $RESULT;
RESULT=$(lightning-cli newoutput 100000);
INITIALPSBT=$(echo $RESULT | jq -r ".psbt");
echo $RESULT;
RESULT=$(lightning-cli splice_init -- $CHANNEL_ID -100500 $INITIALPSBT);
PSBT=$(echo $RESULT | jq -r ".psbt");
echo $RESULT;
RESULT=$(lightning-cli splice_update $CHANNEL_ID $PSBT);
PSBT=$(echo $RESULT | jq -r ".psbt");
echo $RESULT;
lightning-cli splice_signed $CHANNEL_ID $PSBT
RETURN VALUE
On success, an object is returned, containing:
- psbt (string): the (incomplete) PSBT of the splice transaction
SEE ALSO
AUTHOR
@dusty_daemon
RESOURCES
Main web site: https://github.com/ElementsProject/lightning