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

issue sidhujag opened this issue on June 6, 2019
  1. sidhujag commented at 6:31 PM on June 6, 2019: none

    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;
    
  2. sidhujag cross-referenced this on Jun 6, 2019 from issue Dev 4.x by sidhujag
  3. MarcoFalke added the label Bug on Apr 28, 2020
  4. MarcoFalke added the label Wallet on Apr 28, 2020
  5. kouloumos commented at 3:02 PM on September 1, 2022: 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.
  6. kouloumos cross-referenced this on Sep 1, 2022 from issue wallet: Filter-out "send" addresses from `listreceivedby*` by kouloumos

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-20 06:54 UTC