| 874 | } |
| 875 | |
| 876 | static bool |
| 877 | openchannel2_signed_deserialize(struct openchannel2_psbt_payload *payload, |
| 878 | const char *buffer, const jsmntok_t *toks) |
| 879 | { |
| 880 | struct subd *dualopend = payload->dualopend; |
| 881 | struct wally_psbt *psbt; |
| 882 | |
| 883 | if (!hook_extract_psbt(NULL, dualopend, buffer, |
| 884 | toks, "openchannel2_sign", |
| 885 | false, &psbt)) |
| 886 | return false; |
| 887 | |
| 888 | /* We require the PSBT to meet certain criteria such as |
| 889 | * extra, proprietary fields (`serial_id`s) or |
| 890 | * to have a `redeemscripts` iff the inputs are P2SH. |
| 891 | * |
| 892 | * Since this is externally provided, we confirm that |
| 893 | * they've done the right thing / haven't lost any required info. |
| 894 | */ |
| 895 | if (!psbt_has_required_fields(psbt)) |
| 896 | fatal("Plugin supplied PSBT that's missing required fields. %s", |
| 897 | type_to_string(tmpctx, struct wally_psbt, psbt)); |
| 898 | |
| 899 | /* Verify that inputs/outputs are the same. Note that this is a |
| 900 | * 'de minimus' check -- we just look at serial_ids. If you've |
| 901 | * totally managled the data here but left the serial_ids intact, |
| 902 | * you'll get a failure back from the peer when you send |
| 903 | * commitment sigs */ |
| 904 | if (psbt_contribs_changed(payload->psbt, psbt)) |
| 905 | fatal("Plugin must not change psbt input/output set. " |
| 906 | "orig: %s. updated: %s", |
| 907 | type_to_string(tmpctx, struct wally_psbt, |
| 908 | payload->psbt), |
| 909 | type_to_string(tmpctx, struct wally_psbt, |
| 910 | psbt)); |
| 911 | |
| 912 | if (payload->psbt) |
| 913 | tal_free(payload->psbt); |
| 914 | |
| 915 | payload->psbt = tal_steal(payload, psbt); |
| 916 | return true; |
| 917 | } |
| 918 | |
| 919 | static void |
| 920 | openchannel2_sign_hook_cb(struct openchannel2_psbt_payload *payload STEALS) |
nothing calls this directly
no test coverage detected