Check vector v for validity
(v)
| 111 | ] |
| 112 | |
| 113 | def is_valid(v): |
| 114 | '''Check vector v for validity''' |
| 115 | if len(set(v) - set(b58chars)) > 0: |
| 116 | return is_valid_bech32(v) |
| 117 | result = b58decode_chk(v) |
| 118 | if result is None: |
| 119 | return is_valid_bech32(v) |
| 120 | for template in templates: |
| 121 | prefix = bytearray(template[0]) |
| 122 | suffix = bytearray(template[2]) |
| 123 | if result.startswith(prefix) and result.endswith(suffix): |
| 124 | if (len(result) - len(prefix) - len(suffix)) == template[1]: |
| 125 | return True |
| 126 | return is_valid_bech32(v) |
| 127 | |
| 128 | def is_valid_bech32(v): |
| 129 | '''Check vector v for bech32 validity''' |
no test coverage detected