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. maflcko added the label Bug on Apr 28, 2020
  3. maflcko added the label Wallet on Apr 28, 2020
  4. 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.
  5. pablomartin4btc referenced this in commit 85a2a850dd on Aug 7, 2026
  6. pablomartin4btc referenced this in commit 4f94c2e82a on Aug 7, 2026
  7. pablomartin4btc referenced this in commit 873c054805 on Aug 7, 2026
  8. pablomartin4btc referenced this in commit 089c883c55 on Aug 7, 2026
  9. achow101 closed this on Aug 10, 2026

  10. achow101 referenced this in commit e8cc21c57f on Aug 10, 2026

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-08-21 17:54 UTC

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