Skip to content

Commit

Permalink
splice: Add plugin for magic “splice all” command
Browse files Browse the repository at this point in the history
The command called “splice” can take a json payload or a ‘splice script’, process it into a list of ‘actions’ and then execute those actions.

These actions include or will include everything you would want to do with a splice:
* Splice into a channel
* Splice out of a channel
* Fund from wallet
* Deposit to wallet
* Send funds to bitcoin address

Changelog-Added: A new magic “splice” command is added that can take a ‘splice script’ or json payload and perform any complex splice across multiple channels merging the result into a single transaction. Some features are disabled and will be added in time.
  • Loading branch information
ddustin committed Jan 22, 2024
1 parent 609ac0e commit ab31aa7
Show file tree
Hide file tree
Showing 4 changed files with 1,107 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ PLUGIN_SPENDER_SRC := \
plugins/spender/main.c \
plugins/spender/multifundchannel.c \
plugins/spender/multiwithdraw.c \
plugins/spender/openchannel.c
plugins/spender/openchannel.c \
plugins/spender/splice.c
PLUGIN_SPENDER_HEADER := \
plugins/spender/multifundchannel.h \
plugins/spender/multiwithdraw.h \
plugins/spender/fundchannel.h \
plugins/spender/multifundchannel.h \
plugins/spender/openchannel.h
plugins/spender/openchannel.h \
plugins/spender/splice.h
PLUGIN_SPENDER_OBJS := $(PLUGIN_SPENDER_SRC:.c=.o)

PLUGIN_FUNDER_SRC := \
Expand Down Expand Up @@ -164,6 +166,7 @@ PLUGIN_COMMON_OBJS := \
common/pseudorand.o \
common/random_select.o \
common/scb_wiregen.o \
common/splice_script.o \
common/setup.o \
common/status_levels.o \
common/type_to_string.o \
Expand Down
2 changes: 2 additions & 0 deletions plugins/spender/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <plugins/spender/multifundchannel.h>
#include <plugins/spender/multiwithdraw.h>
#include <plugins/spender/openchannel.h>
#include <plugins/spender/splice.h>

/*~ The spender plugin contains various commands that handle
* spending from the onchain wallet. */
Expand All @@ -27,6 +28,7 @@ int main(int argc, char **argv)
tal_expand(&commands, multiwithdraw_commands, num_multiwithdraw_commands);
tal_expand(&commands, fundchannel_commands, num_fundchannel_commands);
tal_expand(&commands, multifundchannel_commands, num_multifundchannel_commands);
tal_expand(&commands, splice_commands, num_splice_commands);
/* tal_expand(&commands, whatever_commands, num_whatever_commands); */

notifs = tal_arr(NULL, struct plugin_notification, 0);
Expand Down
Loading

0 comments on commit ab31aa7

Please sign in to comment.