Correctly return p2pkh/p2sh labels for z_listunifiedreceivers

This commit is contained in:
Kris Nuttycombe 2022-03-25 09:11:11 -06:00
parent 8630891c5a
commit dc4afca405
4 changed files with 10 additions and 10 deletions

View File

@ -106,11 +106,11 @@ class WalletAccountsTest(BitcoinTestFramework):
assert(ua0 != ua1)
# The UA contains the expected receiver kinds.
self.check_receiver_types(ua0, ['transparent', 'sapling', 'orchard'])
self.check_receiver_types(ua0_2, ['transparent', 'sapling', 'orchard'])
self.check_receiver_types(ua0, ['p2pkh', 'sapling', 'orchard'])
self.check_receiver_types(ua0_2, ['p2pkh', 'sapling', 'orchard'])
self.check_receiver_types(ua0_3, [ 'sapling', 'orchard'])
self.check_receiver_types(ua0_4, ['transparent', 'orchard'])
self.check_receiver_types(ua1, ['transparent', 'sapling', 'orchard'])
self.check_receiver_types(ua0_4, ['p2pkh', 'orchard'])
self.check_receiver_types(ua1, ['p2pkh', 'sapling', 'orchard'])
# The balances of the accounts are all zero.
self.check_balance(0, 0, ua0, {})

View File

@ -389,13 +389,13 @@ class ListReceivedTest (BitcoinTestFramework):
unified_addr = r['address']
receivers = node.z_listunifiedreceivers(unified_addr)
assert_equal(len(receivers), 3)
assert 'transparent' in receivers
assert 'p2pkh' in receivers
assert 'sapling' in receivers
assert 'orchard' in receivers
assert_raises_message(
JSONRPCException,
"The provided address is a bare receiver from a Unified Address in this wallet.",
node.z_listreceivedbyaddress, receivers['transparent'], 0)
node.z_listreceivedbyaddress, receivers['p2pkh'], 0)
assert_raises_message(
JSONRPCException,
"The provided address is a bare receiver from a Unified Address in this wallet.",
@ -411,7 +411,7 @@ class ListReceivedTest (BitcoinTestFramework):
self.generate_and_sync(height+5)
# Create a UTXO that unified_address's transparent component references, on node1
outputs = {receivers['transparent']: 0.2}
outputs = {receivers['p2pkh']: 0.2}
txid_taddr = node.sendmany("", outputs)
r = node.z_listreceivedbyaddress(unified_addr, 0)

View File

@ -302,7 +302,7 @@ class WalletZSendmanyTest(BitcoinTestFramework):
# Send funds to the transparent receivers of both addresses.
for ua in [n1ua0, n1ua1]:
taddr = self.nodes[1].z_listunifiedreceivers(ua)['transparent']
taddr = self.nodes[1].z_listunifiedreceivers(ua)['p2pkh']
self.nodes[0].sendtoaddress(taddr, 2)
self.sync_all()

View File

@ -3535,10 +3535,10 @@ UniValue z_listunifiedreceivers(const UniValue& params, bool fHelp)
result.pushKV("sapling", keyIO.EncodePaymentAddress(addr));
},
[&](const CScriptID& addr) {
result.pushKV("transparent", keyIO.EncodePaymentAddress(addr));
result.pushKV("p2sh", keyIO.EncodePaymentAddress(addr));
},
[&](const CKeyID& addr) {
result.pushKV("transparent", keyIO.EncodePaymentAddress(addr));
result.pushKV("p2pkh", keyIO.EncodePaymentAddress(addr));
},
[](auto rest) {},
}, receiver);