From f1fed40ac295c6027f506de1b58600c8e6e859bb Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 4 Feb 2023 16:18:24 +1030 Subject: [PATCH] features: make name of peer storage features match spec. And we should always represent them as is, not as optional: it's possible in future we could *require* "WANT_PEER_BACKUP_STORAGE". Signed-off-by: Rusty Russell --- common/features.c | 16 ++++++++-------- common/features.h | 10 ++++++++-- plugins/chanbackup.c | 4 ++-- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/common/features.c b/common/features.c index d6f443452..96f1bbff6 100644 --- a/common/features.c +++ b/common/features.c @@ -136,12 +136,12 @@ static const struct feature_style feature_styles[] = { [NODE_ANNOUNCE_FEATURE] = FEATURE_REPRESENT, [BOLT11_FEATURE] = FEATURE_DONT_REPRESENT, [CHANNEL_FEATURE] = FEATURE_DONT_REPRESENT } }, - { PEER_STORAGE_FEATURE, - .copy_style = { [INIT_FEATURE] = FEATURE_REPRESENT_AS_OPTIONAL, - [NODE_ANNOUNCE_FEATURE] = FEATURE_REPRESENT_AS_OPTIONAL } }, - { YOUR_PEER_STORAGE_FEATURE, - .copy_style = { [INIT_FEATURE] = FEATURE_REPRESENT_AS_OPTIONAL, - [NODE_ANNOUNCE_FEATURE] = FEATURE_REPRESENT_AS_OPTIONAL } }, + { OPT_WANT_PEER_BACKUP_STORAGE, + .copy_style = { [INIT_FEATURE] = FEATURE_REPRESENT, + [NODE_ANNOUNCE_FEATURE] = FEATURE_REPRESENT } }, + { OPT_PROVIDE_PEER_BACKUP_STORAGE, + .copy_style = { [INIT_FEATURE] = FEATURE_REPRESENT, + [NODE_ANNOUNCE_FEATURE] = FEATURE_REPRESENT } }, }; struct dependency { @@ -456,8 +456,8 @@ const char *feature_name(const tal_t *ctx, size_t f) "option_quiesce", /* https://github.com/lightning/bolts/pull/869 */ NULL, "option_onion_messages", /* https://github.com/lightning/bolts/pull/759 */ - "option_your_peer_storage", /* 40/41 */ - "option_peer_storage", + "option_want_peer_backup_storage", /* 40/41 */ /* https://github.com/lightning/bolts/pull/881/files */ + "option_provide_peer_backup_storage", /* https://github.com/lightning/bolts/pull/881/files */ "option_channel_type", "option_scid_alias", /* https://github.com/lightning/bolts/pull/910 */ "option_payment_metadata", diff --git a/common/features.h b/common/features.h index efb3567f5..d9ec5744e 100644 --- a/common/features.h +++ b/common/features.h @@ -15,8 +15,6 @@ enum feature_place { BOLT12_INVOICE_FEATURE, }; #define NUM_FEATURE_PLACE (BOLT12_INVOICE_FEATURE+1) -#define PEER_STORAGE_FEATURE 42 -#define YOUR_PEER_STORAGE_FEATURE 40 extern const char *feature_place_names[NUM_FEATURE_PLACE]; /* The complete set of features for all contexts */ @@ -166,4 +164,12 @@ struct feature_set *feature_set_dup(const tal_t *ctx, #define OPT_SHUTDOWN_WRONG_FUNDING 104 +/* BOLT-peer-storage #9: + * + * | 40/41 | `want_peer_backup_storage` | Want to use other nodes to store encrypted backup data | IN ... + * | 42/43 | `provide_peer_backup_storage` | Can store other nodes' encrypted backup data | IN ... + */ +#define OPT_WANT_PEER_BACKUP_STORAGE 40 +#define OPT_PROVIDE_PEER_BACKUP_STORAGE 42 + #endif /* LIGHTNING_COMMON_FEATURES_H */ diff --git a/plugins/chanbackup.c b/plugins/chanbackup.c index e94a897ae..3cf736f87 100644 --- a/plugins/chanbackup.c +++ b/plugins/chanbackup.c @@ -795,10 +795,10 @@ static const struct plugin_command commands[] = { int main(int argc, char *argv[]) { setup_locale(); - struct feature_set *features = feature_set_for_feature(NULL, PEER_STORAGE_FEATURE); + struct feature_set *features = feature_set_for_feature(NULL, OPT_WANT_PEER_BACKUP_STORAGE); feature_set_or(features, take(feature_set_for_feature(NULL, - YOUR_PEER_STORAGE_FEATURE))); + OPT_PROVIDE_PEER_BACKUP_STORAGE))); plugin_main(argv, init, PLUGIN_STATIC, true, features, commands, ARRAY_SIZE(commands),