* segwit_addr_net_decode - Try to decode a Bech32 address and detect * testnet/mainnet/regtest/signet * * This processes the address and returns a string if it is a Bech32 * address specified by BIP173. The string is set whether it is * testnet or signet (both "tb"), mainnet ("bc"), regtest ("bcrt") * It does not check, witness version and program size restrictions. * * Out: witness_vers
| 704 | * Returns string containing the human readable segment of bech32 address |
| 705 | */ |
| 706 | static const char *segwit_addr_net_decode(int *witness_version, |
| 707 | uint8_t *witness_program, |
| 708 | size_t *witness_program_len, |
| 709 | const char *addrz, |
| 710 | const struct chainparams *chainparams) |
| 711 | { |
| 712 | if (segwit_addr_decode(witness_version, witness_program, |
| 713 | witness_program_len, chainparams->onchain_hrp, |
| 714 | addrz)) |
| 715 | return chainparams->onchain_hrp; |
| 716 | else |
| 717 | return NULL; |
| 718 | } |
| 719 | |
| 720 | enum address_parse_result |
| 721 | json_to_address_scriptpubkey(const tal_t *ctx, |
no test coverage detected