aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-01-11 14:55:33 +0100
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-01-11 14:55:37 +0100
commitb168b71a5d30c1441737cace281ffa3cce0357fc (patch)
tree67bedace28db3652690a19a5ac160fb71c0669b0 /test
parent26002570ab600bc653433693b7492b85965ccbce (diff)
parentc467cfffcebb30f829eeb8160166a6b941d97ed6 (diff)
Merge bitcoin/bitcoin#26730: test: add coverage for `purpose` arg in `listlabels`
c467cfffcebb30f829eeb8160166a6b941d97ed6 test: add coverage for `purpose` arg in `listlabels` (brunoerg) Pull request description: This PR adds test coverage for `listlabels` command when specifying the `purpose` (send and receive). https://github.com/bitcoin/bitcoin/blob/dcdfd72861c09a7945b9facc3726177a2d06fa64/src/wallet/rpc/addresses.cpp#L698-L704 ACKs for top commit: kristapsk: ACK c467cfffcebb30f829eeb8160166a6b941d97ed6 Tree-SHA512: 7e7143c1264692f7b22952e7c70dbe9ed3f5dcd2e3b69962a47be9f9c21b3f4a9089ca87962fbc8ff9116e7d2dbeb7f36d6a132c9ac13724a255cfe1b32373a8
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/wallet_labels.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/functional/wallet_labels.py b/test/functional/wallet_labels.py
index f9b951d443..a39700f73a 100755
--- a/test/functional/wallet_labels.py
+++ b/test/functional/wallet_labels.py
@@ -23,7 +23,7 @@ class WalletLabelsTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
- self.num_nodes = 1
+ self.num_nodes = 2
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
@@ -121,8 +121,14 @@ class WalletLabelsTest(BitcoinTestFramework):
label.add_receive_address(address)
label.verify(node)
+ # Check listlabels when passing 'purpose'
+ node2_addr = self.nodes[1].getnewaddress()
+ node.setlabel(node2_addr, "node2_addr")
+ assert_equal(node.listlabels(purpose="send"), ["node2_addr"])
+ assert_equal(node.listlabels(purpose="receive"), sorted(['coinbase'] + [label.name for label in labels]))
+
# Check all labels are returned by listlabels.
- assert_equal(node.listlabels(), sorted(['coinbase'] + [label.name for label in labels]))
+ assert_equal(node.listlabels(), sorted(['coinbase'] + [label.name for label in labels] + ["node2_addr"]))
# Send a transaction to each label.
for label in labels: