| 894 | } |
| 895 | |
| 896 | static struct command_result * |
| 897 | openchannel_init_ok(struct command *cmd, |
| 898 | const char *buf, |
| 899 | const jsmntok_t *result, |
| 900 | struct multifundchannel_destination *dest) |
| 901 | { |
| 902 | struct multifundchannel_command *mfc = dest->mfc; |
| 903 | const jsmntok_t *psbt_tok; |
| 904 | const jsmntok_t *channel_id_tok; |
| 905 | const jsmntok_t *funding_serial_tok; |
| 906 | |
| 907 | plugin_log(mfc->cmd->plugin, LOG_DBG, |
| 908 | "mfc %"PRIu64", dest %u: openchannel_init %s done.", |
| 909 | mfc->id, dest->index, |
| 910 | node_id_to_hexstr(tmpctx, &dest->id)); |
| 911 | |
| 912 | /* We've got the PSBT and channel_id here */ |
| 913 | psbt_tok = json_get_member(buf, result, "psbt"); |
| 914 | if (!psbt_tok) |
| 915 | plugin_err(cmd->plugin, |
| 916 | "openchannel_init did not return " |
| 917 | "'psbt': %.*s", |
| 918 | json_tok_full_len(result), |
| 919 | json_tok_full(buf, result)); |
| 920 | dest->updated_psbt = json_to_psbt(dest->mfc, buf, psbt_tok); |
| 921 | if (!dest->updated_psbt) |
| 922 | plugin_err(cmd->plugin, |
| 923 | "openchannel_init returned invalid " |
| 924 | "'psbt': %.*s", |
| 925 | json_tok_full_len(result), |
| 926 | json_tok_full(buf, result)); |
| 927 | |
| 928 | channel_id_tok = json_get_member(buf, result, "channel_id"); |
| 929 | if (!channel_id_tok) |
| 930 | plugin_err(cmd->plugin, |
| 931 | "openchannel_init did not return " |
| 932 | "'channel_id': %.*s", |
| 933 | json_tok_full_len(result), |
| 934 | json_tok_full(buf, result)); |
| 935 | json_to_channel_id(buf, channel_id_tok, &dest->channel_id); |
| 936 | |
| 937 | funding_serial_tok = json_get_member(buf, result, |
| 938 | "funding_serial"); |
| 939 | if (!funding_serial_tok) |
| 940 | plugin_err(cmd->plugin, |
| 941 | "openchannel_init did not return " |
| 942 | "'funding_serial': %.*s", |
| 943 | json_tok_full_len(result), |
| 944 | json_tok_full(buf, result)); |
| 945 | json_to_u64(buf, funding_serial_tok, &dest->funding_serial); |
| 946 | |
| 947 | dest->state = MULTIFUNDCHANNEL_STARTED; |
| 948 | |
| 949 | /* Port any updates onto 'parent' PSBT */ |
| 950 | if (!update_parent_psbt(dest->mfc, dest, dest->psbt, |
| 951 | dest->updated_psbt, &mfc->psbt)) { |
| 952 | fail_destination_msg(dest, FUNDING_PSBT_INVALID, |
| 953 | "Unable to update parent" |
nothing calls this directly
no test coverage detected