Browse Source

plugins/spender/: New plugin that will eventually absorb all onchain-spending commands.

bump-pyln-proto
ZmnSCPxj jxPCSnmZ 4 years ago
committed by Rusty Russell
parent
commit
e04febfe0c
  1. 1
      plugins/.gitignore
  2. 16
      plugins/Makefile
  3. 33
      plugins/spender/main.c

1
plugins/.gitignore

@ -2,4 +2,5 @@ autoclean
bcli
fundchannel
pay
spenderp
multifundchannel

16
plugins/Makefile

@ -27,6 +27,11 @@ PLUGIN_PAY_LIB_OBJS := $(PLUGIN_PAY_LIB_SRC:.c=.o)
PLUGIN_MULTIFUNDCHANNEL_SRC := plugins/multifundchannel.c
PLUGIN_MULTIFUNDCHANNEL_OBJS := $(PLUGIN_MULTIFUNDCHANNEL_SRC:.c=.o)
PLUGIN_SPENDER_SRC := \
plugins/spender/main.c
PLUGIN_SPENDER_HEADER :=
PLUGIN_SPENDER_OBJS := $(PLUGIN_SPENDER_SRC:.c=.o)
PLUGIN_ALL_SRC := \
$(PLUGIN_AUTOCLEAN_SRC) \
$(PLUGIN_BCLI_SRC) \
@ -36,10 +41,12 @@ PLUGIN_ALL_SRC := \
$(PLUGIN_LIB_SRC) \
$(PLUGIN_MULTIFUNDCHANNEL_SRC) \
$(PLUGIN_PAY_LIB_SRC) \
$(PLUGIN_PAY_SRC)
$(PLUGIN_PAY_SRC) \
$(PLUGIN_SPENDER_SRC)
PLUGIN_ALL_HEADER := \
$(PLUGIN_LIB_HEADER) \
$(PLUGIN_PAY_LIB_HEADER)
$(PLUGIN_PAY_LIB_HEADER) \
$(PLUGIN_SPENDER_HEADER)
PLUGIN_ALL_OBJS := $(PLUGIN_ALL_SRC:.c=.o)
PLUGINS := \
@ -49,7 +56,8 @@ PLUGINS := \
plugins/keysend \
plugins/pay \
plugins/multifundchannel \
plugins/txprepare
plugins/txprepare \
plugins/spenderp
# Make sure these depend on everything.
ALL_C_SOURCES += $(PLUGIN_ALL_SRC)
@ -112,4 +120,6 @@ $(PLUGIN_KEYSEND_OBJS): $(PLUGIN_PAY_LIB_HEADER)
plugins/multifundchannel: bitcoin/chainparams.o common/addr.o $(PLUGIN_MULTIFUNDCHANNEL_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS)
plugins/spenderp: bitcoin/chainparams.o $(PLUGIN_SPENDER_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS)
$(PLUGIN_ALL_OBJS): $(PLUGIN_LIB_HEADER)

33
plugins/spender/main.c

@ -0,0 +1,33 @@
#include <common/utils.h>
#include <plugins/libplugin.h>
/*~ The spender plugin contains various commands that handle
* spending from the onchain wallet. */
static
void spender_init(struct plugin *p, const char *b, const jsmntok_t *t)
{
/* whatever_init(p, b, t); */
}
int main(int argc, char **argv)
{
char *owner = tal(NULL, char);
struct plugin_command *commands;
setup_locale();
commands = tal_arr(owner, struct plugin_command, 0);
/* tal_expand(&commands, whatever_commands, num_whatever_commands); */
plugin_main(argv, &spender_init, PLUGIN_STATIC, true,
NULL,
commands, tal_count(commands),
NULL, 0,
NULL, 0,
NULL);
tal_free(owner);
return 0;
}
Loading…
Cancel
Save