| 702 | } |
| 703 | |
| 704 | static char *opt_force_featureset(const char *optarg, |
| 705 | struct lightningd *ld) |
| 706 | { |
| 707 | char **parts = tal_strsplit(tmpctx, optarg, "/", STR_EMPTY_OK); |
| 708 | if (tal_count(parts) != NUM_FEATURE_PLACE + 1) { |
| 709 | if (!strstarts(optarg, "-") && !strstarts(optarg, "+")) |
| 710 | return "Expected 8 feature sets (init/globalinit/" |
| 711 | " node_announce/channel/bolt11/b12offer/b12invreq/b12inv) each terminated by /" |
| 712 | " OR +/-<single_bit_num>"; |
| 713 | |
| 714 | char *endp; |
| 715 | long int n = strtol(optarg + 1, &endp, 10); |
| 716 | const struct feature_set *f; |
| 717 | if (*endp || endp == optarg + 1) |
| 718 | return "Invalid feature number"; |
| 719 | |
| 720 | f = feature_set_for_feature(NULL, n); |
| 721 | if (strstarts(optarg, "-")) { |
| 722 | feature_set_sub(ld->our_features, take(f)); |
| 723 | } |
| 724 | |
| 725 | if (strstarts(optarg, "+") |
| 726 | && !feature_set_or(ld->our_features, take(f))) |
| 727 | return "Feature already flagged-on"; |
| 728 | |
| 729 | return NULL; |
| 730 | } |
| 731 | for (size_t i = 0; parts[i]; i++) { |
| 732 | char **bits = tal_strsplit(tmpctx, parts[i], ",", STR_EMPTY_OK); |
| 733 | tal_resize(&ld->our_features->bits[i], 0); |
| 734 | |
| 735 | for (size_t j = 0; bits[j]; j++) { |
| 736 | char *endp; |
| 737 | long int n = strtol(bits[j], &endp, 10); |
| 738 | if (*endp || endp == bits[j]) |
| 739 | return "Invalid bitnumber"; |
| 740 | set_feature_bit(&ld->our_features->bits[i], n); |
| 741 | } |
| 742 | } |
| 743 | return NULL; |
| 744 | } |
| 745 | |
| 746 | static char *opt_ignore(void *unused) |
| 747 | { |
nothing calls this directly
no test coverage detected