| 126 | } |
| 127 | |
| 128 | static bool fixup_sig(struct keypair *kp) |
| 129 | { |
| 130 | const u8 *valcursor = kp->value; |
| 131 | size_t vallen = tal_bytelen(kp->value); |
| 132 | struct bitcoin_signature sig; |
| 133 | size_t derlen; |
| 134 | u8 der[73]; |
| 135 | |
| 136 | fromwire_secp256k1_ecdsa_signature(&valcursor, &vallen, &sig.s); |
| 137 | sig.sighash_type = SIGHASH_ALL; |
| 138 | |
| 139 | /* If that didn't parse, or there are more bytes |
| 140 | * left, ignore it */ |
| 141 | if (valcursor == NULL || vallen != 0) |
| 142 | return false; |
| 143 | |
| 144 | derlen = signature_to_der(der, &sig); |
| 145 | kp->value = tal_dup_arr(kp, u8, der, derlen, 0); |
| 146 | return true; |
| 147 | } |
| 148 | |
| 149 | /* I am deeply, deeply unhappy with this code. I initially tried parsing the |
| 150 | * entire PSBT, but that turns out not to be possible without decoding the |
no test coverage detected