Skip to content

Commit e664af2

Browse files
committed
Apply label to all scriptPubKeys of imported combo()
1 parent 6b56873 commit e664af2

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/wallet/wallet.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3632,9 +3632,13 @@ ScriptPubKeyMan* CWallet::AddWalletDescriptor(WalletDescriptor& desc, const Flat
36323632
return nullptr;
36333633
}
36343634

3635-
CTxDestination dest;
3636-
if (!internal && ExtractDestination(script_pub_keys.at(0), dest)) {
3637-
SetAddressBook(dest, label, "receive");
3635+
if (!internal) {
3636+
for (const auto& script : script_pub_keys) {
3637+
CTxDestination dest;
3638+
if (ExtractDestination(script, dest)) {
3639+
SetAddressBook(dest, label, "receive");
3640+
}
3641+
}
36383642
}
36393643
}
36403644

test/functional/tool_wallet.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def log_wallet_timestamp_comparison(self, old, new):
6868
result = 'unchanged' if new == old else 'increased!'
6969
self.log.debug('Wallet file timestamp {}'.format(result))
7070

71-
def get_expected_info_output(self, name="", transactions=0, keypool=2, address=0):
71+
def get_expected_info_output(self, name="", transactions=0, keypool=2, address=0, imported_privs=0):
7272
wallet_name = self.default_wallet_name if name == "" else name
7373
if self.options.descriptors:
7474
output_types = 4 # p2pkh, p2sh, segwit, bech32m
@@ -83,7 +83,7 @@ def get_expected_info_output(self, name="", transactions=0, keypool=2, address=0
8383
Keypool Size: %d
8484
Transactions: %d
8585
Address Book: %d
86-
''' % (wallet_name, keypool * output_types, transactions, address))
86+
''' % (wallet_name, keypool * output_types, transactions, imported_privs * 3 + address))
8787
else:
8888
output_types = 3 # p2pkh, p2sh, segwit. Legacy wallets do not support bech32m.
8989
return textwrap.dedent('''\
@@ -97,7 +97,7 @@ def get_expected_info_output(self, name="", transactions=0, keypool=2, address=0
9797
Keypool Size: %d
9898
Transactions: %d
9999
Address Book: %d
100-
''' % (wallet_name, keypool, transactions, address * output_types))
100+
''' % (wallet_name, keypool, transactions, (address + imported_privs) * output_types))
101101

102102
def read_dump(self, filename):
103103
dump = OrderedDict()
@@ -219,7 +219,7 @@ def test_tool_wallet_info(self):
219219
# shasum_before = self.wallet_shasum()
220220
timestamp_before = self.wallet_timestamp()
221221
self.log.debug('Wallet file timestamp before calling info: {}'.format(timestamp_before))
222-
out = self.get_expected_info_output(address=1)
222+
out = self.get_expected_info_output(imported_privs=1)
223223
self.assert_tool_output(out, '-wallet=' + self.default_wallet_name, 'info')
224224
timestamp_after = self.wallet_timestamp()
225225
self.log.debug('Wallet file timestamp after calling info: {}'.format(timestamp_after))
@@ -250,7 +250,7 @@ def test_tool_wallet_info_after_transaction(self):
250250
shasum_before = self.wallet_shasum()
251251
timestamp_before = self.wallet_timestamp()
252252
self.log.debug('Wallet file timestamp before calling info: {}'.format(timestamp_before))
253-
out = self.get_expected_info_output(transactions=1, address=1)
253+
out = self.get_expected_info_output(transactions=1, imported_privs=1)
254254
self.assert_tool_output(out, '-wallet=' + self.default_wallet_name, 'info')
255255
shasum_after = self.wallet_shasum()
256256
timestamp_after = self.wallet_timestamp()

0 commit comments

Comments
 (0)