Skip to content

Commit 0d41057

Browse files
committed
test: prepare test_upgradetohd_custom for extra options
1 parent 0a4db75 commit 0d41057

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

test/functional/wallet_mnemonicbits.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,30 +101,35 @@ def run_test(self):
101101

102102
def test_upgradetohd_custom(self):
103103
self.log.info("Test upgradetohd with user defined mnemonic")
104-
self.nodes[0].createwallet("w-custom-1a", blank=True)
105-
self.nodes[0].createwallet("w-custom-1b", blank=True)
106-
self.nodes[0].createwallet("w-custom-2", blank=True)
104+
wname_1a = "w-custom-1a"
105+
wname_1b = "w-custom-1b"
106+
wname_2 = "w-custom-2"
107+
108+
wnames = [wname_1a, wname_1b, wname_2]
109+
for wname in wnames:
110+
self.nodes[0].createwallet(wname, blank=True)
111+
107112
custom_mnemonic = "similar behave slot swim scissors throw planet view ghost laugh drift calm"
108113
# this address belongs to custom mnemonic with no passphrase
109114
custom_address_1 = "yLpq97zZUsFQ2rdMqhcPKkYT36MoPK4Hob"
110115
# this address belongs to custom mnemonic with passphrase "custom-passphrase"
111116
custom_address_2 = "yYBPeZQcqgQHu9dxA5pKBWtYbK2hwfFHxf"
112117

113-
self.nodes[0].get_wallet_rpc('w-custom-1a').upgradetohd(custom_mnemonic)
114-
self.nodes[0].get_wallet_rpc('w-custom-1b').upgradetohd(custom_mnemonic, "")
115-
self.nodes[0].get_wallet_rpc('w-custom-2').upgradetohd(custom_mnemonic, "custom-passphrase")
118+
self.nodes[0].get_wallet_rpc(wname_1a).upgradetohd(custom_mnemonic)
119+
self.nodes[0].get_wallet_rpc(wname_1b).upgradetohd(custom_mnemonic, "")
120+
self.nodes[0].get_wallet_rpc(wname_2).upgradetohd(custom_mnemonic, "custom-passphrase")
116121
self.generate(self.nodes[0], COINBASE_MATURITY + 1)
117122

118123
self.nodes[0].get_wallet_rpc(self.default_wallet_name).sendtoaddress(custom_address_1, 11)
119124
self.nodes[0].get_wallet_rpc(self.default_wallet_name).sendtoaddress(custom_address_2, 12)
120125
self.generate(self.nodes[0], 1)
121126
self.restart_node(0)
122-
self.nodes[0].loadwallet('w-custom-1a')
123-
self.nodes[0].loadwallet('w-custom-1b')
124-
self.nodes[0].loadwallet('w-custom-2')
125-
assert_equal(11, self.nodes[0].get_wallet_rpc('w-custom-1a').getbalance())
126-
assert_equal(11, self.nodes[0].get_wallet_rpc('w-custom-1b').getbalance())
127-
assert_equal(12, self.nodes[0].get_wallet_rpc('w-custom-2').getbalance())
127+
for wname in wnames:
128+
self.nodes[0].loadwallet(wname)
129+
130+
assert_equal(11, self.nodes[0].get_wallet_rpc(wname_1a).getbalance())
131+
assert_equal(11, self.nodes[0].get_wallet_rpc(wname_1b).getbalance())
132+
assert_equal(12, self.nodes[0].get_wallet_rpc(wname_2).getbalance())
128133

129134

130135
if __name__ == '__main__':

0 commit comments

Comments
 (0)