|
|
@ -119,31 +119,6 @@ struct state { |
|
|
|
struct feature_set *our_features; |
|
|
|
}; |
|
|
|
|
|
|
|
static u8 *no_upfront_shutdown_script(const tal_t *ctx, struct state *state) |
|
|
|
{ |
|
|
|
#if DEVELOPER |
|
|
|
/* This is a hack, for feature testing */ |
|
|
|
const char *e = getenv("DEV_OPENINGD_UPFRONT_SHUTDOWN_SCRIPT"); |
|
|
|
if (e) |
|
|
|
return tal_hexdata(ctx, e, strlen(e)); |
|
|
|
#endif |
|
|
|
|
|
|
|
/* BOLT #2:
|
|
|
|
* |
|
|
|
* - if both nodes advertised the `option_upfront_shutdown_script` |
|
|
|
* feature: |
|
|
|
* - MUST include `upfront_shutdown_script` with either a valid |
|
|
|
* `shutdown_scriptpubkey` as required by `shutdown` |
|
|
|
* `scriptpubkey`, or a zero-length `shutdown_scriptpubkey` |
|
|
|
* (ie. `0x0000`). |
|
|
|
*/ |
|
|
|
if (feature_negotiated(state->our_features, state->their_features, |
|
|
|
OPT_UPFRONT_SHUTDOWN_SCRIPT)) |
|
|
|
return tal_arr(ctx, u8, 0); |
|
|
|
|
|
|
|
return NULL; |
|
|
|
} |
|
|
|
|
|
|
|
/*~ If we can't agree on parameters, we fail to open the channel. If we're
|
|
|
|
* the opener, we need to tell lightningd, otherwise it never really notices. */ |
|
|
|
static void negotiation_aborted(struct state *state, bool am_opener, |
|
|
@ -371,7 +346,10 @@ static u8 *funder_channel_start(struct state *state, u8 channel_flags) |
|
|
|
return NULL; |
|
|
|
|
|
|
|
if (!state->upfront_shutdown_script[LOCAL]) |
|
|
|
state->upfront_shutdown_script[LOCAL] = no_upfront_shutdown_script(state, state); |
|
|
|
state->upfront_shutdown_script[LOCAL] |
|
|
|
= no_upfront_shutdown_script(state, |
|
|
|
state->our_features, |
|
|
|
state->their_features); |
|
|
|
|
|
|
|
open_tlvs = tlv_open_channel_tlvs_new(tmpctx); |
|
|
|
open_tlvs->upfront_shutdown_script |
|
|
@ -955,7 +933,10 @@ static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg) |
|
|
|
} |
|
|
|
|
|
|
|
if (!state->upfront_shutdown_script[LOCAL]) |
|
|
|
state->upfront_shutdown_script[LOCAL] = no_upfront_shutdown_script(state, state); |
|
|
|
state->upfront_shutdown_script[LOCAL] |
|
|
|
= no_upfront_shutdown_script(state, |
|
|
|
state->our_features, |
|
|
|
state->their_features); |
|
|
|
|
|
|
|
/* OK, we accept! */ |
|
|
|
accept_tlvs = tlv_accept_channel_tlvs_new(tmpctx); |
|
|
|