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

Function validate_remote_upfront_shutdown

openingd/common.c:207–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207char *validate_remote_upfront_shutdown(const tal_t *ctx,
208 struct feature_set *our_features,
209 const u8 *their_features,
210 u8 *shutdown_scriptpubkey STEALS,
211 u8 **state_script)
212{
213 bool anysegwit = feature_negotiated(our_features,
214 their_features,
215 OPT_SHUTDOWN_ANYSEGWIT);
216
217 bool anchors = anchors_negotiated(our_features, their_features);
218 /* BOLT #2:
219 *
220 * - MUST include `upfront_shutdown_script` with either a valid
221 * `shutdown_scriptpubkey` as required by `shutdown` `scriptpubkey`,
222 * or a zero-length `shutdown_scriptpubkey` (ie. `0x0000`).
223 */
224 /* We turn empty into NULL. */
225 if (tal_bytelen(shutdown_scriptpubkey) == 0)
226 shutdown_scriptpubkey = tal_free(shutdown_scriptpubkey);
227
228 *state_script = tal_steal(ctx, shutdown_scriptpubkey);
229
230 if (shutdown_scriptpubkey
231 && !valid_shutdown_scriptpubkey(shutdown_scriptpubkey, anysegwit, !anchors, false))
232 return tal_fmt(tmpctx,
233 "Unacceptable upfront_shutdown_script %s",
234 tal_hex(tmpctx, shutdown_scriptpubkey));
235 return NULL;
236}
237
238
239void validate_initial_commitment_signature(int hsm_fd,

Callers 2

Calls 6

feature_negotiatedFunction · 0.85
anchors_negotiatedFunction · 0.85
tal_bytelenFunction · 0.85
tal_freeFunction · 0.85
tal_hexFunction · 0.85

Tested by

no test coverage detected