test: add coverage for `purpose` arg in `listlabels` #26730

pull brunoerg wants to merge 1 commits into bitcoin:master from brunoerg:2022-12-wallet-labels-verbose changing 1 files +8 −2
  1. brunoerg commented at 2:13 PM on December 20, 2022: contributor

    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

  2. DrahtBot commented at 2:13 PM on December 20, 2022: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK kristapsk
    Concept ACK yusufsahinhamza, rserranon

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  3. DrahtBot added the label Tests on Dec 20, 2022
  4. test: add coverage for `purpose` arg in `listlabels` c467cfffce
  5. brunoerg force-pushed on Dec 20, 2022
  6. yusufsahinhamza commented at 11:09 PM on December 20, 2022: contributor

    Concept ACK

  7. in test/functional/wallet_labels.py:89 in c467cfffce
      82 | @@ -83,8 +83,14 @@ def run_test(self):
      83 |              label.add_receive_address(address)
      84 |              label.verify(node)
      85 |  
      86 | +        # Check listlabels when passing 'purpose'
      87 | +        node2_addr = self.nodes[1].getnewaddress()
      88 | +        node.setlabel(node2_addr, "node2_addr")
      89 | +        assert_equal(node.listlabels(purpose="send"), ["node2_addr"])
    


    rserranon commented at 1:56 AM on January 11, 2023:

    It is not clear to me why node2_addr is a send address, I tried to replicate it in regtest but all my new addresses are receive addresses, maybe is worth clarifying it.


    brunoerg commented at 12:43 PM on January 11, 2023:

    node = self.nodes[0] -> so, node refers to self.nodes[0].

    Here we are getting a new address from self.nodes[1], so it will receive btc using this address. For this reason, it can be used by self.nodes[0] to send Bitcoins.

    So, node2_addr for self.nodes[1] is "receive" and for self.nodes[0] is "send".

  8. rserranon changes_requested
  9. rserranon commented at 1:58 AM on January 11, 2023: none

    Concept ACK, Test ACK

  10. kristapsk approved
  11. kristapsk commented at 12:52 PM on January 11, 2023: contributor

    ACK c467cfffcebb30f829eeb8160166a6b941d97ed6

  12. maflcko referenced this in commit b168b71a5d on Jan 11, 2023
  13. maflcko closed this on Jan 11, 2023

  14. sidhujag referenced this in commit 26bbb33e44 on Jan 11, 2023
  15. bitcoin locked this on Jan 11, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-02 03:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me