Skip to content

Commit d254057

Browse files
nepetrustyrussell
authored andcommitted
plugin: remove features when plugin is disabled
We need to remove the feature bits set via a plugins get_manifest response when the init response disables the plugin. Changelog-Fixed Remove feature bits set by a plugin when the plugin disables itself during init. Signed-off-by: Peter Neuroth <[email protected]>
1 parent 8895ca2 commit d254057

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lightningd/plugin.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,6 +1819,11 @@ static const char *plugin_parse_getmanifest_response(const char *buffer,
18191819
return tal_fmt(plugin,
18201820
"Custom featurebits already present");
18211821
}
1822+
1823+
/* Store fset to allow to remove feature bits when init returns disabled */
1824+
plugin->fset = tal_dup_or_null(plugin, struct feature_set, fset);
1825+
} else {
1826+
plugin->fset = NULL;
18221827
}
18231828

18241829
custommsgtok = json_get_member(buffer, resulttok, "custommessages");
@@ -2148,6 +2153,10 @@ static void plugin_config_cb(const char *buffer,
21482153
JSON_SCAN_TAL(tmpctx, json_strdup, &disable)) == NULL) {
21492154
/* Don't get upset if this was a built-in! */
21502155
plugin->important = false;
2156+
if (plugin->fset)
2157+
/* We don't have those features anymore! */
2158+
feature_set_sub(plugin->plugins->ld->our_features,
2159+
plugin->fset);
21512160
plugin_kill(plugin, LOG_DBG,
21522161
"disabled itself at init: %s",
21532162
disable);

lightningd/plugin.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ struct plugin {
120120

121121
/* Can this handle check commands? */
122122
bool can_check;
123+
124+
/* custom feature-bits */
125+
struct feature_set *fset;
123126
};
124127

125128
/**

0 commit comments

Comments
 (0)