Skip to content

Commit 8fa6f07

Browse files
committed
QA: wallet_implicitsegwit: Add tests for -walletimplicitsegwit=0
1 parent 9828136 commit 8fa6f07

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/functional/wallet_implicitsegwit.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,54 @@ def check_implicit_transactions(implicit_keys, implicit_node):
3838
b_address = key_to_address(pubkey, b)
3939
assert ('receive', b_address) in tuple((tx['category'], tx['address']) for tx in txs)
4040

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+
4153
class ImplicitSegwitTest(BitcoinTestFramework):
4254
def add_options(self, parser):
4355
self.add_wallet_options(parser, descriptors=False)
4456

4557
def set_test_params(self):
4658
self.num_nodes = 2
4759
self.supports_cli = False
60+
self.extra_args = [
61+
[
62+
"-walletimplicitsegwit=1",
63+
],
64+
[
65+
"-walletimplicitsegwit=0",
66+
],
67+
]
4868

4969
def skip_test_if_missing_module(self):
5070
self.skip_if_no_wallet()
5171

5272
def run_test(self):
5373
self.log.info("Manipulating addresses and sending transactions to all variations")
5474
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])
5576

5677
self.sync_all()
5778

5879
self.log.info("Checking that transactions show up correctly without a restart")
5980
check_implicit_transactions(implicit_keys, self.nodes[0])
81+
check_explicit_transactions(explicit_keys, self.nodes[1])
6082

6183
self.log.info("Checking that transactions still show up correctly after a restart")
6284
self.restart_node(0)
6385
self.restart_node(1)
6486

6587
check_implicit_transactions(implicit_keys, self.nodes[0])
88+
check_explicit_transactions(explicit_keys, self.nodes[1])
6689

6790
if __name__ == '__main__':
6891
ImplicitSegwitTest(__file__).main()

0 commit comments

Comments
 (0)