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

Function validate_remote_upfront_shutdown

openingd/common.c:290–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290char *validate_remote_upfront_shutdown(const tal_t *ctx,
291 struct feature_set *our_features,
292 const u8 *their_features,
293 u8 *shutdown_scriptpubkey STEALS,
294 u8 **state_script)
295{
296 bool anysegwit = feature_negotiated(our_features,
297 their_features,
298 OPT_SHUTDOWN_ANYSEGWIT);
299
300 bool anchors = anchors_negotiated(our_features, their_features);
301 /* BOLT #2:
302 *
303 * - MUST include `upfront_shutdown_script` with either a valid
304 * `shutdown_scriptpubkey` as required by `shutdown` `scriptpubkey`,
305 * or a zero-length `shutdown_scriptpubkey` (ie. `0x0000`).
306 */
307 /* We turn empty into NULL. */
308 if (tal_bytelen(shutdown_scriptpubkey) == 0)
309 shutdown_scriptpubkey = tal_free(shutdown_scriptpubkey);
310
311 *state_script = tal_steal(ctx, shutdown_scriptpubkey);
312
313 if (shutdown_scriptpubkey
314 && !valid_shutdown_scriptpubkey(shutdown_scriptpubkey, anysegwit, !anchors, false))
315 return tal_fmt(tmpctx,
316 "Unacceptable upfront_shutdown_script %s",
317 tal_hex(tmpctx, shutdown_scriptpubkey));
318 return NULL;
319}
320
321
322void 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