Distinguish between P2PKH and P2SH in UA test vectors
This commit is contained in:
parent
0392dd089c
commit
2c97e9a99a
|
@ -127,10 +127,11 @@ def main():
|
||||||
else:
|
else:
|
||||||
orchard_raw_addr = None
|
orchard_raw_addr = None
|
||||||
|
|
||||||
|
is_p2pkh = rand.bool()
|
||||||
receivers = [
|
receivers = [
|
||||||
orchard_raw_addr,
|
orchard_raw_addr,
|
||||||
sapling_raw_addr,
|
sapling_raw_addr,
|
||||||
(rand.bool(), t_addr)
|
(is_p2pkh, t_addr)
|
||||||
]
|
]
|
||||||
ua = encode_unified(receivers)
|
ua = encode_unified(receivers)
|
||||||
|
|
||||||
|
@ -140,7 +141,8 @@ def main():
|
||||||
assert decoded.get('transparent') == t_addr
|
assert decoded.get('transparent') == t_addr
|
||||||
|
|
||||||
test_vectors.append({
|
test_vectors.append({
|
||||||
't_addr_bytes': t_addr,
|
'p2pkh_bytes': t_addr if is_p2pkh else None,
|
||||||
|
'p2sh_bytes': None if is_p2pkh else t_addr,
|
||||||
'sapling_raw_addr': sapling_raw_addr,
|
'sapling_raw_addr': sapling_raw_addr,
|
||||||
'orchard_raw_addr': orchard_raw_addr,
|
'orchard_raw_addr': orchard_raw_addr,
|
||||||
'unified_addr': ua.encode()
|
'unified_addr': ua.encode()
|
||||||
|
@ -150,7 +152,11 @@ def main():
|
||||||
args,
|
args,
|
||||||
'unified_address',
|
'unified_address',
|
||||||
(
|
(
|
||||||
('t_addr_bytes', {
|
('p2pkh_bytes', {
|
||||||
|
'rust_type': 'Option<[u8; 20]>',
|
||||||
|
'rust_fmt': lambda x: None if x is None else Some(x),
|
||||||
|
}),
|
||||||
|
('p2sh_bytes', {
|
||||||
'rust_type': 'Option<[u8; 20]>',
|
'rust_type': 'Option<[u8; 20]>',
|
||||||
'rust_fmt': lambda x: None if x is None else Some(x),
|
'rust_fmt': lambda x: None if x is None else Some(x),
|
||||||
}),
|
}),
|
||||||
|
@ -170,4 +176,3 @@ def main():
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue