mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-28 18:02:44 +02:00
rpc: getreceivedbylabel, don't loop over the entire wallet txs map if no destinations were found for the input label.
If wallet.GetLabelAddresses() returns an empty vector (the wallet does not have addresses with that label in the addressbook) or if none of the returned destinations are from the wallet, we can return the function right away.
This commit is contained in:
@@ -131,6 +131,9 @@ class ReceivedByTest(BitcoinTestFramework):
|
||||
txid = self.nodes[0].sendtoaddress(addr, 0.1)
|
||||
self.sync_all()
|
||||
|
||||
# getreceivedbylabel returns an error if the wallet doesn't own the label
|
||||
assert_raises_rpc_error(-4, "Label not found in wallet", self.nodes[0].getreceivedbylabel, "dummy")
|
||||
|
||||
# listreceivedbylabel should return received_by_label_json because of 0 confirmations
|
||||
assert_array_result(self.nodes[1].listreceivedbylabel(),
|
||||
{"label": label},
|
||||
|
Reference in New Issue
Block a user