Exemplo n.º 1
0
 def test_valid_checksum(self):
     """Test checksum creation and validation."""
     for test in VALID_CHECKSUM:
         hrp, _ = segwit_addr.bech32_decode(test)
         self.assertIsNotNone(hrp)
         pos = test.rfind('1')
         test = test[:pos + 1] + chr(ord(test[pos + 1]) ^ 1) + test[pos + 2:]
         hrp, _ = segwit_addr.bech32_decode(test)
         self.assertIsNone(hrp)
Exemplo n.º 2
0
 def test_invalid_checksum(self):
     """Test validation of invalid checksums."""
     for test in INVALID_CHECKSUM:
         hrp, _ = segwit_addr.bech32_decode(test)
         self.assertIsNone(hrp)