Skip to content

Commit 8696888

Browse files
committed
Add descriptor wallet output to tool_wallet.py
Descriptor wallets output slightly different information in the wallet tool, so check that output when in descriptor wallet mode.
1 parent 3457679 commit 8696888

File tree

1 file changed

+56
-25
lines changed

1 file changed

+56
-25
lines changed

test/functional/tool_wallet.py

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ def test_invalid_tool_commands_and_args(self):
7171
self.assert_raises_tool_error('Error: two methods provided (info and create). Only one method should be provided.', 'info', 'create')
7272
self.assert_raises_tool_error('Error parsing command line arguments: Invalid parameter -foo', '-foo')
7373
locked_dir = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets")
74+
error = 'Error initializing wallet database environment "{}"!'.format(locked_dir)
75+
if self.options.descriptors:
76+
error = "SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another bitcoind?"
7477
self.assert_raises_tool_error(
75-
'Error initializing wallet database environment "{}"!'.format(locked_dir),
78+
error,
7679
'-wallet=' + self.default_wallet_name,
7780
'info',
7881
)
@@ -95,19 +98,33 @@ def test_tool_wallet_info(self):
9598
# shasum_before = self.wallet_shasum()
9699
timestamp_before = self.wallet_timestamp()
97100
self.log.debug('Wallet file timestamp before calling info: {}'.format(timestamp_before))
98-
out = textwrap.dedent('''\
99-
Wallet info
100-
===========
101-
Name: \
101+
if self.options.descriptors:
102+
out = textwrap.dedent('''\
103+
Wallet info
104+
===========
105+
Name: default_wallet
106+
Format: sqlite
107+
Descriptors: yes
108+
Encrypted: no
109+
HD (hd seed available): yes
110+
Keypool Size: 6
111+
Transactions: 0
112+
Address Book: 1
113+
''')
114+
else:
115+
out = textwrap.dedent('''\
116+
Wallet info
117+
===========
118+
Name: \
102119
103-
Format: bdb
104-
Descriptors: no
105-
Encrypted: no
106-
HD (hd seed available): yes
107-
Keypool Size: 2
108-
Transactions: 0
109-
Address Book: 3
110-
''')
120+
Format: bdb
121+
Descriptors: no
122+
Encrypted: no
123+
HD (hd seed available): yes
124+
Keypool Size: 2
125+
Transactions: 0
126+
Address Book: 3
127+
''')
111128
self.assert_tool_output(out, '-wallet=' + self.default_wallet_name, 'info')
112129
timestamp_after = self.wallet_timestamp()
113130
self.log.debug('Wallet file timestamp after calling info: {}'.format(timestamp_after))
@@ -138,19 +155,33 @@ def test_tool_wallet_info_after_transaction(self):
138155
shasum_before = self.wallet_shasum()
139156
timestamp_before = self.wallet_timestamp()
140157
self.log.debug('Wallet file timestamp before calling info: {}'.format(timestamp_before))
141-
out = textwrap.dedent('''\
142-
Wallet info
143-
===========
144-
Name: \
158+
if self.options.descriptors:
159+
out = textwrap.dedent('''\
160+
Wallet info
161+
===========
162+
Name: default_wallet
163+
Format: sqlite
164+
Descriptors: yes
165+
Encrypted: no
166+
HD (hd seed available): yes
167+
Keypool Size: 6
168+
Transactions: 1
169+
Address Book: 1
170+
''')
171+
else:
172+
out = textwrap.dedent('''\
173+
Wallet info
174+
===========
175+
Name: \
145176
146-
Format: bdb
147-
Descriptors: no
148-
Encrypted: no
149-
HD (hd seed available): yes
150-
Keypool Size: 2
151-
Transactions: 1
152-
Address Book: 3
153-
''')
177+
Format: bdb
178+
Descriptors: no
179+
Encrypted: no
180+
HD (hd seed available): yes
181+
Keypool Size: 2
182+
Transactions: 1
183+
Address Book: 3
184+
''')
154185
self.assert_tool_output(out, '-wallet=' + self.default_wallet_name, 'info')
155186
shasum_after = self.wallet_shasum()
156187
timestamp_after = self.wallet_timestamp()

0 commit comments

Comments
 (0)