diff --git a/common/json_tok.c b/common/json_tok.c index e30dfc35b..d6e292cc3 100644 --- a/common/json_tok.c +++ b/common/json_tok.c @@ -433,14 +433,15 @@ json_to_address_scriptpubkey(const tal_t *ctx, bip173 = segwit_addr_net_decode(&witness_version, witness_program, &witness_program_len, addrz, chainparams); - if (bip173) { - bool witness_ok = false; - if (witness_version == 0 && (witness_program_len == 20 || - witness_program_len == 32)) { + bool witness_ok; + + /* We know the rules for v0, rest remain undefined */ + if (witness_version == 0) { + witness_ok = (witness_program_len == 20 || + witness_program_len == 32); + } else witness_ok = true; - } - /* Insert other witness versions here. */ if (witness_ok) { *scriptpubkey = scriptpubkey_witness_raw(ctx, witness_version,