Browse Source

plugin/offers: skeleton for offers plugin (EXPERIMENTAL_FEATURES)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa
Rusty Russell 4 years ago
committed by Christian Decker
parent
commit
26e0cbeb7c
  1. 14
      plugins/Makefile
  2. 32
      plugins/offers.c

14
plugins/Makefile

@ -25,6 +25,9 @@ PLUGIN_PAY_LIB_SRC := plugins/libplugin-pay.c
PLUGIN_PAY_LIB_HEADER := plugins/libplugin-pay.h
PLUGIN_PAY_LIB_OBJS := $(PLUGIN_PAY_LIB_SRC:.c=.o)
PLUGIN_OFFERS_SRC := plugins/offers.c
PLUGIN_OFFERS_OBJS := $(PLUGIN_OFFERS_SRC:.c=.o)
PLUGIN_SPENDER_SRC := \
plugins/spender/fundchannel.c \
plugins/spender/main.c \
@ -48,6 +51,11 @@ PLUGIN_ALL_SRC := \
$(PLUGIN_PAY_LIB_SRC) \
$(PLUGIN_PAY_SRC) \
$(PLUGIN_SPENDER_SRC)
ifeq ($(EXPERIMENTAL_FEATURES),1)
PLUGIN_ALL_SRC += $(PLUGIN_OFFERS_SRC)
endif
PLUGIN_ALL_HEADER := \
$(PLUGIN_LIB_HEADER) \
$(PLUGIN_PAY_LIB_HEADER) \
@ -62,6 +70,10 @@ PLUGINS := \
plugins/txprepare \
plugins/spenderp
ifeq ($(EXPERIMENTAL_FEATURES),1)
PLUGINS += plugins/offers
endif
# Make sure these depend on everything.
ALL_C_SOURCES += $(PLUGIN_ALL_SRC)
ALL_C_HEADERS += $(PLUGIN_ALL_HEADER)
@ -122,6 +134,8 @@ $(PLUGIN_KEYSEND_OBJS): $(PLUGIN_PAY_LIB_HEADER)
plugins/spenderp: bitcoin/chainparams.o bitcoin/psbt.o common/psbt_open.o $(PLUGIN_SPENDER_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS)
plugins/offers: bitcoin/chainparams.o $(PLUGIN_OFFERS_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) common/bolt12.o common/bolt12_merkle.o wire/bolt12_exp_wiregen.o $(WIRE_OBJS) bitcoin/block.o common/channel_id.o bitcoin/preimage.o $(JSMN_OBJS) $(CCAN_OBJS)
$(PLUGIN_ALL_OBJS): $(PLUGIN_LIB_HEADER)
# Generated from PLUGINS definition in plugins/Makefile

32
plugins/offers.c

@ -0,0 +1,32 @@
/* This plugin covers both sending and receiving offers */
#include <bitcoin/chainparams.h>
#include <bitcoin/preimage.h>
#include <ccan/array_size/array_size.h>
#include <common/bolt12.h>
#include <common/bolt12_merkle.h>
#include <common/json_stream.h>
#include <common/overflows.h>
#include <common/type_to_string.h>
#include <plugins/libplugin.h>
#include <wire/onion_wire.h>
static const struct plugin_hook hooks[] = {
};
static void init(struct plugin *p,
const char *buf UNUSED,
const jsmntok_t *config UNUSED)
{
}
static const struct plugin_command commands[] = {
};
int main(int argc, char *argv[])
{
setup_locale();
plugin_main(argv, init, PLUGIN_RESTARTABLE, true, NULL, commands,
ARRAY_SIZE(commands), NULL, 0, hooks, ARRAY_SIZE(hooks),
NULL);
}
Loading…
Cancel
Save