@@ -686,13 +686,14 @@ struct command_result *param_secrets_array(struct command *cmd,
686
686
}
687
687
688
688
/**
689
- * segwit_addr_net_decode - Try to decode a Bech32 address and detect
689
+ * segwit_addr_net_decode - Try to decode a Bech32(m) address and detect
690
690
* testnet/mainnet/regtest/signet
691
691
*
692
692
* This processes the address and returns a string if it is a Bech32
693
- * address specified by BIP173. The string is set whether it is
694
- * testnet or signet (both "tb"), mainnet ("bc"), regtest ("bcrt")
695
- * It does not check, witness version and program size restrictions.
693
+ * address specified by BIP173 or Bech32m as by BIP350. The string is
694
+ * set whether it is testnet or signet (both "tb"), mainnet ("bc"),
695
+ * regtest ("bcrt"). It does not check witness version and program size
696
+ * restrictions.
696
697
*
697
698
* Out: witness_version: Pointer to an int that will be updated to contain
698
699
* the witness program version (between 0 and 16 inclusive).
@@ -732,7 +733,7 @@ json_to_address_scriptpubkey(const tal_t *ctx,
732
733
size_t witness_program_len ;
733
734
734
735
char * addrz ;
735
- const char * bip173 ;
736
+ const char * bech32 ;
736
737
737
738
u8 addr_version ;
738
739
@@ -756,12 +757,12 @@ json_to_address_scriptpubkey(const tal_t *ctx,
756
757
addrz = tal_dup_arr (tmpctx , char , buffer + tok -> start , tok -> end - tok -> start , 1 );
757
758
addrz [tok -> end - tok -> start ] = '\0' ;
758
759
759
- bip173 = segwit_addr_net_decode (& witness_version , witness_program ,
760
+ bech32 = segwit_addr_net_decode (& witness_version , witness_program ,
760
761
& witness_program_len , addrz , chainparams );
761
- if (bip173 ) {
762
+ if (bech32 ) {
762
763
bool witness_ok ;
763
764
764
- /* We know the rules for v0, rest remain undefined */
765
+ /* Only V0 has restricted lengths of witness programs */
765
766
if (witness_version == 0 ) {
766
767
witness_ok = (witness_program_len == 20 ||
767
768
witness_program_len == 32 );
@@ -771,7 +772,7 @@ json_to_address_scriptpubkey(const tal_t *ctx,
771
772
if (!witness_ok )
772
773
return ADDRESS_PARSE_UNRECOGNIZED ;
773
774
774
- if (!streq (bip173 , chainparams -> onchain_hrp ))
775
+ if (!streq (bech32 , chainparams -> onchain_hrp ))
775
776
return ADDRESS_PARSE_WRONG_NETWORK ;
776
777
777
778
* scriptpubkey = scriptpubkey_witness_raw (ctx , witness_version ,
0 commit comments