Decode a segwit confidential address. Its payload is longer than the payload for unconfidential address by 33 bytes (the length of blinding pubkey)
(hrp, addr)
| 84 | |
| 85 | |
| 86 | def decode(hrp, addr): |
| 87 | """Decode a segwit confidential address. |
| 88 | Its payload is longer than the payload for unconfidential address |
| 89 | by 33 bytes (the length of blinding pubkey)""" |
| 90 | |
| 91 | hrpgot, data = blech32_decode(addr) |
| 92 | if hrpgot != hrp: |
| 93 | return (None, None) |
| 94 | decoded = convertbits(data[1:], 5, 8, False) |
| 95 | if decoded is None or len(decoded) < 2 or len(decoded) > 40+33: |
| 96 | return (None, None) |
| 97 | if data[0] > 16: |
| 98 | return (None, None) |
| 99 | if data[0] == 0 and len(decoded) != 20+33 and len(decoded) != 32+33: |
| 100 | return (None, None) |
| 101 | return (data[0], decoded) |
| 102 | |
| 103 | |
| 104 | def encode(hrp, witver, witprog): |
no test coverage detected