| 838 | } |
| 839 | |
| 840 | static struct command_result * |
| 841 | json_openchannel2_call(struct command *cmd, |
| 842 | const char *buf, |
| 843 | const jsmntok_t *params) |
| 844 | { |
| 845 | struct open_info *info = new_open_info(cmd); |
| 846 | struct amount_msat max_htlc_inflight, htlc_minimum; |
| 847 | u64 commitment_feerate_perkw, |
| 848 | feerate_our_max, feerate_our_min; |
| 849 | u32 to_self_delay, max_accepted_htlcs; |
| 850 | u16 channel_flags; |
| 851 | const char *err; |
| 852 | |
| 853 | err = json_scan(tmpctx, buf, params, |
| 854 | "{openchannel2:" |
| 855 | "{id:%" |
| 856 | ",channel_id:%" |
| 857 | ",their_funding_msat:%" |
| 858 | ",max_htlc_value_in_flight_msat:%" |
| 859 | ",htlc_minimum_msat:%" |
| 860 | ",funding_feerate_per_kw:%" |
| 861 | ",commitment_feerate_per_kw:%" |
| 862 | ",feerate_our_max:%" |
| 863 | ",feerate_our_min:%" |
| 864 | ",to_self_delay:%" |
| 865 | ",max_accepted_htlcs:%" |
| 866 | ",channel_flags:%" |
| 867 | ",locktime:%" |
| 868 | ",channel_max_msat:%}}", |
| 869 | JSON_SCAN(json_to_node_id, &info->id), |
| 870 | JSON_SCAN(json_to_channel_id, &info->cid), |
| 871 | JSON_SCAN(json_to_msat_as_sats, &info->their_funding), |
| 872 | JSON_SCAN(json_to_msat, &max_htlc_inflight), |
| 873 | JSON_SCAN(json_to_msat, &htlc_minimum), |
| 874 | JSON_SCAN(json_to_u64, &info->funding_feerate_perkw), |
| 875 | JSON_SCAN(json_to_u64, &commitment_feerate_perkw), |
| 876 | JSON_SCAN(json_to_u64, &feerate_our_max), |
| 877 | JSON_SCAN(json_to_u64, &feerate_our_min), |
| 878 | JSON_SCAN(json_to_u32, &to_self_delay), |
| 879 | JSON_SCAN(json_to_u32, &max_accepted_htlcs), |
| 880 | JSON_SCAN(json_to_u16, &channel_flags), |
| 881 | JSON_SCAN(json_to_u32, &info->locktime), |
| 882 | JSON_SCAN(json_to_msat_as_sats, &info->channel_max)); |
| 883 | |
| 884 | if (err) |
| 885 | plugin_err(cmd->plugin, |
| 886 | "`openchannel2` payload did not scan %s: %.*s", |
| 887 | err, json_tok_full_len(params), |
| 888 | json_tok_full(buf, params)); |
| 889 | |
| 890 | /* Channel lease info isn't necessarily included, ignore any err */ |
| 891 | json_scan(tmpctx, buf, params, |
| 892 | "{openchannel2:{" |
| 893 | "requested_lease_msat:%" |
| 894 | ",lease_blockheight_start:%" |
| 895 | ",node_blockheight:%}}", |
| 896 | JSON_SCAN(json_to_msat_as_sats, &info->requested_lease), |
| 897 | JSON_SCAN(json_to_u32, &info->lease_blockheight), |
nothing calls this directly
no test coverage detected