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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-02-04 16:18:24 +10:30 committed by Alex Myers
parent 68d9b21aec
commit f1fed40ac2
3 changed files with 18 additions and 12 deletions

View file

@ -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",

View file

@ -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 */

View file

@ -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),