Skip to content

Commit 522a147

Browse files
instagibbsdgpv
authored andcommitted
Add blech32 roundtrip test for python implementation
1 parent 32564b0 commit 522a147

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/functional/feature_confidential_transactions.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
import os
2929
import re
3030

31+
from test_framework.liquid_addr import (
32+
encode,
33+
decode,
34+
)
35+
3136
class CTTest (BitcoinTestFramework):
3237

3338
def set_test_params(self):
@@ -104,6 +109,15 @@ def run_test(self):
104109
print("Testing wallet secret recovery")
105110
self.test_wallet_recovery()
106111

112+
print("Test blech32 python roundtrip")
113+
# blech/bech are aliased, both are blech32
114+
for addrtype in ["bech32", "blech32"]:
115+
addr_to_rt = self.nodes[0].getnewaddress("", addrtype)
116+
hrp = addr_to_rt[:2]
117+
assert_equal(hrp, "el")
118+
(witver, witprog) = decode(hrp, addr_to_rt)
119+
assert_equal(encode(hrp, witver, witprog), addr_to_rt)
120+
107121
# Test that "blech32" gives a blinded segwit address.
108122
blech32_addr = self.nodes[0].getnewaddress("", "blech32")
109123
blech32_addr_info = self.nodes[0].getaddressinfo(blech32_addr)

0 commit comments

Comments
 (0)