Skip to content

listrecievedbyaddress with include_empty not filtering out "send" side of address book #16159

Closed

Description

@sidhujag

I noticed if you call listreceivedbyaddress with true for incude_empty it was skipping the cross-reference against mapTally. The skip causes the entire address book (including "send" purpose) to be included in the results erroneously. There should be a "if purpose not 'send' then include results".

Code would be inserted here:

https://github.com/bitcoin/bitcoin/blob/master/src/wallet/rpcwallet.cpp#L1122

something like:

        if(item_it->second.purpose == "send")
            continue;

Activity

  1. kouloumos commented on Sep 1, 2022

    @kouloumos
    Contributor

    Addresses with a "send" purpose should not be included in the results of the listreceivedby* RPCs.

    When does a "send" purpose is assigned?

    How to reproduce (legacy & descriptor wallets):

    • Create 2 wallets (w1, w2)
       # (using variables for productivity)
       NODE1="src/bitcoin-cli -regtest -datadir=/tmp/node1-datadir"
       $NODE1 -named createwallet wallet_name=w1
       $NODE1 -named createwallet wallet_name=w2
      
       w1="$(echo $NODE1) -rpcwallet=w1"
       w2="$(echo $NODE1) -rpcwallet=w2"
      
       $NODE1 generatetoaddress 101 $($w1 getnewaddress) # fund wallet1
    • Get an address for w2 (This address is added as receiving in the address book of w2)
      w2_addr=$($w2 getnewaddress)
    • Send tx from w1 to w2_addr using the GUI or use the setlabel RPC with $w1 setlabel $w2_addr.
    • Observe that w2_addr is returned from $w1 -named listreceivedbyaddress include_empty=true.
  2. added a commit that references this issue on Aug 10, 2026
    e8cc21c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions