| 1497 | } |
| 1498 | |
| 1499 | static void add_config(struct lightningd *ld, |
| 1500 | struct json_stream *response, |
| 1501 | const struct opt_table *opt, |
| 1502 | const char *name, size_t len) |
| 1503 | { |
| 1504 | char *name0 = tal_strndup(tmpctx, name, len); |
| 1505 | char *answer = NULL; |
| 1506 | char buf[OPT_SHOW_LEN + sizeof("...")]; |
| 1507 | |
| 1508 | #if DEVELOPER |
| 1509 | if (strstarts(name0, "dev-")) { |
| 1510 | /* Ignore dev settings */ |
| 1511 | return; |
| 1512 | } |
| 1513 | #endif |
| 1514 | |
| 1515 | if (opt->type & OPT_NOARG) { |
| 1516 | if (opt->desc == opt_hidden) { |
| 1517 | /* Ignore hidden options (deprecated) */ |
| 1518 | } else if (opt->cb == (void *)opt_usage_and_exit |
| 1519 | || opt->cb == (void *)version_and_exit |
| 1520 | || is_restricted_ignored(opt->cb) |
| 1521 | || opt->cb == (void *)opt_lightningd_usage |
| 1522 | || opt->cb == (void *)test_subdaemons_and_exit |
| 1523 | /* FIXME: we can't recover this. */ |
| 1524 | || opt->cb == (void *)opt_clear_plugins) { |
| 1525 | /* These are not important */ |
| 1526 | } else if (opt->cb == (void *)opt_set_bool) { |
| 1527 | const bool *b = opt->u.carg; |
| 1528 | json_add_bool(response, name0, *b); |
| 1529 | } else if (opt->cb == (void *)opt_set_invbool) { |
| 1530 | const bool *b = opt->u.carg; |
| 1531 | json_add_bool(response, name0, !*b); |
| 1532 | } else if (opt->cb == (void *)opt_set_offline) { |
| 1533 | json_add_bool(response, name0, |
| 1534 | !ld->reconnect && !ld->listen); |
| 1535 | } else if (opt->cb == (void *)opt_start_daemon) { |
| 1536 | json_add_bool(response, name0, |
| 1537 | ld->daemon_parent_fd != -1); |
| 1538 | } else if (opt->cb == (void *)opt_set_hsm_password) { |
| 1539 | json_add_bool(response, "encrypted-hsm", ld->encrypted_hsm); |
| 1540 | } else if (opt->cb == (void *)opt_set_wumbo) { |
| 1541 | json_add_bool(response, name0, |
| 1542 | feature_offered(ld->our_features |
| 1543 | ->bits[INIT_FEATURE], |
| 1544 | OPT_LARGE_CHANNELS)); |
| 1545 | } else if (opt->cb == (void *)opt_set_dual_fund) { |
| 1546 | json_add_bool(response, name0, |
| 1547 | feature_offered(ld->our_features |
| 1548 | ->bits[INIT_FEATURE], |
| 1549 | OPT_DUAL_FUND)); |
| 1550 | } else if (opt->cb == (void *)opt_set_onion_messages) { |
| 1551 | json_add_bool(response, name0, |
| 1552 | feature_offered(ld->our_features |
| 1553 | ->bits[INIT_FEATURE], |
| 1554 | OPT_ONION_MESSAGES)); |
| 1555 | } else if (opt->cb == (void *)opt_set_offers) { |
| 1556 | json_add_bool(response, name0, ld->config.exp_offers); |
no test coverage detected