Browse Source

plugin: Include featurebits registered by plugins in invoices

travis-debug
Christian Decker 5 years ago
committed by Rusty Russell
parent
commit
58c9a6a004
  1. 8
      lightningd/invoice.c
  2. 7
      lightningd/test/run-invoice-select-inchan.c

8
lightningd/invoice.c

@ -1002,8 +1002,14 @@ static struct command_result *json_invoice(struct command *cmd,
info->b11->description_hash = NULL;
info->b11->payment_secret = tal_dup(info->b11, struct secret,
&payment_secret);
info->b11->features = get_offered_bolt11features(info->b11);
/* Which features should we announce to the node receiving this invoice?
* This is a combination of natively supported features and featurebits
* that plugins asked us to include in the invoice. */
info->b11->features = featurebits_or(
info->b11, take(get_offered_bolt11features(info->b11)),
take(plugins_collect_featurebits(tmpctx, cmd->ld->plugins,
PLUGIN_FEATURES_INVOICE)));
#if DEVELOPER
info->b11->routes = unpack_routes(info->b11, buffer, routes);

7
lightningd/test/run-invoice-select-inchan.c

@ -95,6 +95,9 @@ char *encode_scriptpubkey_to_addr(const tal_t *ctx UNNEEDED,
/* Generated stub for fatal */
void fatal(const char *fmt UNNEEDED, ...)
{ fprintf(stderr, "fatal called!\n"); abort(); }
/* Generated stub for featurebits_or */
u8 *featurebits_or(const tal_t *ctx UNNEEDED, const u8 *f1 TAKES UNNEEDED, const u8 *f2 TAKES UNNEEDED)
{ fprintf(stderr, "featurebits_or called!\n"); abort(); }
/* Generated stub for feature_is_set */
bool feature_is_set(const u8 *features UNNEEDED, size_t bit UNNEEDED)
{ fprintf(stderr, "feature_is_set called!\n"); abort(); }
@ -377,6 +380,10 @@ void per_peer_state_set_fds(struct per_peer_state *pps UNNEEDED,
void plugin_hook_call_(struct lightningd *ld UNNEEDED, const struct plugin_hook *hook UNNEEDED,
void *payload UNNEEDED, void *cb_arg UNNEEDED)
{ fprintf(stderr, "plugin_hook_call_ called!\n"); abort(); }
/* Generated stub for plugins_collect_featurebits */
u8 *plugins_collect_featurebits(const tal_t *ctx UNNEEDED, const struct plugins *plugins UNNEEDED,
enum plugin_features_type type UNNEEDED)
{ fprintf(stderr, "plugins_collect_featurebits called!\n"); abort(); }
/* Generated stub for subd_release_channel */
void subd_release_channel(struct subd *owner UNNEEDED, void *channel UNNEEDED)
{ fprintf(stderr, "subd_release_channel called!\n"); abort(); }

Loading…
Cancel
Save