mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 11:59:16 +01:00
libplugin: allow stealing of feature sets, make keysend do that.
Otherwise the NULL parents look like a memleak. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
1f7fb33563
commit
952471e7a3
3 changed files with 9 additions and 9 deletions
|
@ -480,14 +480,14 @@ static const char *notification_topics[] = {
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct feature_set features;
|
||||
struct feature_set *features = tal(NULL, struct feature_set);
|
||||
setup_locale();
|
||||
|
||||
for (int i=0; i<ARRAY_SIZE(features.bits); i++)
|
||||
features.bits[i] = tal_arr(NULL, u8, 0);
|
||||
set_feature_bit(&features.bits[NODE_ANNOUNCE_FEATURE], KEYSEND_FEATUREBIT);
|
||||
for (int i=0; i<ARRAY_SIZE(features->bits); i++)
|
||||
features->bits[i] = tal_arr(features, u8, 0);
|
||||
set_feature_bit(&features->bits[NODE_ANNOUNCE_FEATURE], KEYSEND_FEATUREBIT);
|
||||
|
||||
plugin_main(argv, init, PLUGIN_STATIC, true, &features, commands,
|
||||
plugin_main(argv, init, PLUGIN_STATIC, true, features, commands,
|
||||
ARRAY_SIZE(commands), NULL, 0, hooks, ARRAY_SIZE(hooks),
|
||||
notification_topics, ARRAY_SIZE(notification_topics), NULL);
|
||||
}
|
||||
|
|
|
@ -1369,7 +1369,7 @@ static struct plugin *new_plugin(const tal_t *ctx,
|
|||
const jsmntok_t *),
|
||||
const enum plugin_restartability restartability,
|
||||
bool init_rpc,
|
||||
struct feature_set *features,
|
||||
struct feature_set *features STEALS,
|
||||
const struct plugin_command *commands,
|
||||
size_t num_commands,
|
||||
const struct plugin_notification *notif_subs,
|
||||
|
@ -1399,7 +1399,7 @@ static struct plugin *new_plugin(const tal_t *ctx,
|
|||
p->next_outreq_id = 0;
|
||||
uintmap_init(&p->out_reqs);
|
||||
|
||||
p->our_features = features;
|
||||
p->our_features = tal_steal(p, features);
|
||||
if (init_rpc) {
|
||||
/* Sync RPC FIXME: maybe go full async ? */
|
||||
p->rpc_conn = tal(p, struct rpc_conn);
|
||||
|
@ -1442,7 +1442,7 @@ void plugin_main(char *argv[],
|
|||
const char *buf, const jsmntok_t *),
|
||||
const enum plugin_restartability restartability,
|
||||
bool init_rpc,
|
||||
struct feature_set *features,
|
||||
struct feature_set *features STEALS,
|
||||
const struct plugin_command *commands,
|
||||
size_t num_commands,
|
||||
const struct plugin_notification *notif_subs,
|
||||
|
|
|
@ -292,7 +292,7 @@ void NORETURN LAST_ARG_NULL plugin_main(char *argv[],
|
|||
const jsmntok_t *),
|
||||
const enum plugin_restartability restartability,
|
||||
bool init_rpc,
|
||||
struct feature_set *features,
|
||||
struct feature_set *features STEALS,
|
||||
const struct plugin_command *commands,
|
||||
size_t num_commands,
|
||||
const struct plugin_notification *notif_subs,
|
||||
|
|
Loading…
Add table
Reference in a new issue