fix: do not send send peerstorage msg when disabled

This commit will disable the peerstorage plugins
when the feature is not enabled.

I found this issue with lnprototest, and I guess
we did not find it with normal run because
other the unknown messages are ingored?

Changelog-Fixed: Disable the protocol messages when peerstorage is disabled.
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
This commit is contained in:
Vincenzo Palazzo
2023-02-23 15:52:27 +01:00
committed by Alex Myers
parent 355a7ae827
commit bcc94b2d43

View File

@@ -346,6 +346,9 @@ static struct command_result *peer_after_listdatastore(struct command *cmd,
return command_hook_success(cmd); return command_hook_success(cmd);
struct out_req *req; struct out_req *req;
if (!peer_backup)
return command_hook_success(cmd);
u8 *payload = towire_your_peer_storage(cmd, hexdata); u8 *payload = towire_your_peer_storage(cmd, hexdata);
plugin_log(cmd->plugin, LOG_DBG, plugin_log(cmd->plugin, LOG_DBG,
@@ -443,7 +446,7 @@ static struct command_result *after_listpeers(struct command *cmd,
json_to_bool(buf, json_get_member(buf, peer, "connected"), json_to_bool(buf, json_get_member(buf, peer, "connected"),
&is_connected); &is_connected);
if (is_connected) { if (is_connected && peer_backup) {
const jsmntok_t *nodeid; const jsmntok_t *nodeid;
struct node_id node_id; struct node_id node_id;