@@ -38,31 +38,54 @@ def check_implicit_transactions(implicit_keys, implicit_node):
38
38
b_address = key_to_address (pubkey , b )
39
39
assert ('receive' , b_address ) in tuple ((tx ['category' ], tx ['address' ]) for tx in txs )
40
40
41
+ def check_explicit_transactions (explicit_keys , explicit_node ):
42
+ # The explicit segwit node doesn't allow conversion from legacy to segwit
43
+ txs = explicit_node .listtransactions (None , 99999 )
44
+ for a in address_types :
45
+ pubkey = explicit_keys [a ]
46
+ for b in address_types :
47
+ b_address = key_to_address (pubkey , b )
48
+ if a == 'legacy' and a != b :
49
+ assert (('receive' , b_address ) not in tuple ((tx ['category' ], tx ['address' ]) for tx in txs ))
50
+ else :
51
+ assert (('receive' , b_address ) in tuple ((tx ['category' ], tx ['address' ]) for tx in txs ))
52
+
41
53
class ImplicitSegwitTest (BitcoinTestFramework ):
42
54
def add_options (self , parser ):
43
55
self .add_wallet_options (parser , descriptors = False )
44
56
45
57
def set_test_params (self ):
46
58
self .num_nodes = 2
47
59
self .supports_cli = False
60
+ self .extra_args = [
61
+ [
62
+ "-walletimplicitsegwit=1" ,
63
+ ],
64
+ [
65
+ "-walletimplicitsegwit=0" ,
66
+ ],
67
+ ]
48
68
49
69
def skip_test_if_missing_module (self ):
50
70
self .skip_if_no_wallet ()
51
71
52
72
def run_test (self ):
53
73
self .log .info ("Manipulating addresses and sending transactions to all variations" )
54
74
implicit_keys = send_a_to_b (self .nodes [0 ], self .nodes [1 ])
75
+ explicit_keys = send_a_to_b (self .nodes [1 ], self .nodes [0 ])
55
76
56
77
self .sync_all ()
57
78
58
79
self .log .info ("Checking that transactions show up correctly without a restart" )
59
80
check_implicit_transactions (implicit_keys , self .nodes [0 ])
81
+ check_explicit_transactions (explicit_keys , self .nodes [1 ])
60
82
61
83
self .log .info ("Checking that transactions still show up correctly after a restart" )
62
84
self .restart_node (0 )
63
85
self .restart_node (1 )
64
86
65
87
check_implicit_transactions (implicit_keys , self .nodes [0 ])
88
+ check_explicit_transactions (explicit_keys , self .nodes [1 ])
66
89
67
90
if __name__ == '__main__' :
68
91
ImplicitSegwitTest (__file__ ).main ()
0 commit comments