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

issue sidhujag openend 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:

    0        if(item_it->second.purpose == "send")
    1            continue;
    
  2. MarcoFalke added the label Bug on Apr 28, 2020
  3. MarcoFalke added the label Wallet on Apr 28, 2020
  4. kouloumos commented at 3:02 pm on September 1, 2022: member

    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)
      0 # (using variables for productivity)
      1 NODE1="src/bitcoin-cli -regtest -datadir=/tmp/node1-datadir"
      2 $NODE1 -named createwallet wallet_name=w1
      3 $NODE1 -named createwallet wallet_name=w2
      4
      5 w1="$(echo $NODE1) -rpcwallet=w1"
      6 w2="$(echo $NODE1) -rpcwallet=w2"
      7
      8 $NODE1 generatetoaddress 101 $($w1 getnewaddress) # fund wallet1
      
    • Get an address for w2 (This address is added as receiving in the address book of w2)
      0w2_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.

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: 2024-11-23 09:12 UTC

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