Skip to content

Commit b168b71

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#26730: test: add coverage for purpose arg in listlabels
c467cff 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 c467cff Tree-SHA512: 7e7143c1264692f7b22952e7c70dbe9ed3f5dcd2e3b69962a47be9f9c21b3f4a9089ca87962fbc8ff9116e7d2dbeb7f36d6a132c9ac13724a255cfe1b32373a8
2 parents 2600257 + c467cff commit b168b71

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/functional/wallet_labels.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def add_options(self, parser):
2323

2424
def set_test_params(self):
2525
self.setup_clean_chain = True
26-
self.num_nodes = 1
26+
self.num_nodes = 2
2727

2828
def skip_test_if_missing_module(self):
2929
self.skip_if_no_wallet()
@@ -121,8 +121,14 @@ def run_test(self):
121121
label.add_receive_address(address)
122122
label.verify(node)
123123

124+
# Check listlabels when passing 'purpose'
125+
node2_addr = self.nodes[1].getnewaddress()
126+
node.setlabel(node2_addr, "node2_addr")
127+
assert_equal(node.listlabels(purpose="send"), ["node2_addr"])
128+
assert_equal(node.listlabels(purpose="receive"), sorted(['coinbase'] + [label.name for label in labels]))
129+
124130
# Check all labels are returned by listlabels.
125-
assert_equal(node.listlabels(), sorted(['coinbase'] + [label.name for label in labels]))
131+
assert_equal(node.listlabels(), sorted(['coinbase'] + [label.name for label in labels] + ["node2_addr"]))
126132

127133
# Send a transaction to each label.
128134
for label in labels:

0 commit comments

Comments
 (0)