MCPcopy Create free account
hub / github.com/ElementsProject/lightning / fixup_sig

Function fixup_sig

wallet/psbt_fixup.c:128–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128static 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

Callers 1

psbt_fixupFunction · 0.85

Calls 3

tal_bytelenFunction · 0.85
signature_to_derFunction · 0.85

Tested by

no test coverage detected