You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
listreceivedbyaddress incorrectly shows watchonly addresses as empty #10468
The arguments are minconf, include_empty, and include_watchonly. If include_empty is true then watchonly addresses are returned as having a 0 balance even if they have a positive balance. Only when include_watchonly is also true do watchonly addresses with a balance return with their correct balance.
When include_empty is true and include_watchonly is false then the watchonly addresses should not be returned at all.
The expected behavior with listreceivedbyaddress is that when include_empty=true and include_watchonly=false the watchonly addresses should not be returned at all.
What has been reported and what I was able to reproduce is that when watchonly addresses are not supposed to be included (include_watchonly=false), they are included if include_empty=true and are always returned as having 0 balance even if they have a positive balance.
I was able to reproduced this using legacy wallets on regtest.
Preparation
# create directories for nodes
mkdir -p /tmp/node1-datadir
mkdir -p /tmp/node2-datadir
# run node1
src/bitcoind -regtest -datadir=/tmp/node1-datadir
# run node2
src/bitcoind -regtest -datadir=/tmp/node2-datadir -rpcport=18300 -port=18400
# (using variables for productivity)
NODE1="src/bitcoin-cli -regtest -datadir=/tmp/node1-datadir"
NODE2="src/bitcoin-cli -regtest -datadir=/tmp/node2-datadir -rpcport=18300"# create wallets (legacy) $NODE1 -named createwallet wallet_name=wallet1 descriptors=false
$NODE2 -named createwallet wallet_name=wallet2 descriptors=false
watch_address=$($NODE1 getnewaddress)# generate address on node1$NODE2 importaddress $watch_address# add address as watchonly on node2
Observe issue when there is no balance in $watch_address.
# This returns nothing, **as expected**.$NODE2 -named listreceivedbyaddress include_empty=false include_watchonly={false,true}
[]
# This should also return nothing, but it returns the empty $watch_address$NODE2 -named listreceivedbyaddress include_empty=true include_watchonly=false
[
{
"address": $watch_address,
"amount": 0.00000000,
"confirmations": 0,
"label": "",
"txids": [
]
}
]
It looks like this issue has been resolved by the descriptor wallet. If that’s not the case, please let us know by commenting here or opening a new issue.
Activity
Sjors commentedon Jul 10, 2018
Just noticed this while reviewing #9662. It's quite weird:
kouloumos commentedon Aug 3, 2022
The expected behavior with
listreceivedbyaddressis that wheninclude_empty=trueandinclude_watchonly=falsethe watchonly addresses should not be returned at all.What has been reported and what I was able to reproduce is that when watchonly addresses are not supposed to be included (
include_watchonly=false), they are included ifinclude_empty=trueand are always returned as having 0 balance even if they have a positive balance.I was able to reproduced this using legacy wallets on regtest.
Note: The same behavior can also reproduced for the
listreceivedbylabelRPC.aureleoules commentedon Sep 20, 2022
bitcoin/src/wallet/rpc/transactions.cpp
Lines 148 to 150 in 375ebad
these values are never set because the loop above it
bitcoin/src/wallet/rpc/transactions.cpp
Lines 97 to 131 in 375ebad
is never called because
wallet.mapWalletis empty.willcl-ark commentedon Oct 21, 2025
It looks like this issue has been resolved by the descriptor wallet. If that’s not the case, please let us know by commenting here or opening a new issue.