Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sidhujag opened this issue Jun 6, 2019 · 1 comment

Comments

@sidhujag
Copy link

sidhujag commented Jun 6, 2019

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;
@kouloumos
Copy link
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants