GetBalance and listaccounts returns an incorrect balance (testnet)
Problem: The testnet account Testnet "elmo" shows a balance of 1.02 but should show 0.01.
bitcoin-cli -testnet getinfo {"version": 100000, "protocolversion": 70002, "walletversion": 60000, "balance": 2.66964380, "blocks": 350108, "timeoffset": 0, "connections": 0, " proxy ":" "," difficulty ": 1.00000000," testnet ": true," keypoololdest ": 1426225664," keypoolsize ": 101," paytxfee ": 0.00000000," relayfee ": 0.00001000," errors ":" "} bitcoin -cli -testnet listaccounts {"": 1.64964380, "elmo": 1.02000000,} bitcoin-cli -testnet getbalance elmo 1.02000000 bitcoin-cli -testnet listreceivedbyaccount 1 true [{"account": "", "amount": 2.06080000, " confirmations ": 1040}, {" account ":" elmo "," amount ": 1.02000000," confirmations ": 22149},
However when using listunspent to check UTXO in the wallet, there is only one UTXO set for "elmo" account and this UTXO shows a 0.01 balance.
{ "Txid": "42e2579dd090415713510c5cc58aa13afd14cfc2a1fb6ebee873afc169927e8b", "vout": 0, "address": "myZ2mEYZt1CyRPgdE6oXRbAJWbaaTtTwRi", "account": "elmo", "scriptPubKey": "76a914c5d6d3854e653be3c31e66d322cb0a05cb0a17c888ac", "amount": 0.01000000, "confirmations": 22 149 , "spendable": true}
Here are two addresses associated with "elmo" account
bitcoin-cli -testnet getaddressesbyaccount elmo ["mkwLg4ARNWimVW1Bh9uxv9SKdfNnPHRHWr", "myZ2mEYZt1CyRPgdE6oXRbAJWbaaTtTwRi"]
Two separate explorer blocks report the balances of each address as:
http://tbtc.blockr.io/address/info/myZ2mEYZt1CyRPgdE6oXRbAJWbaaTtTwRihttps://www.blocktrail.com/tBTC/address/myZ2mEYZt1CyRPgdE6oXRbAJWbaaTtTwRi0.01
http://tbtc.blockr.io/address/info/mkwLg4ARNWimVW1Bh9uxv9SKdfNnPHRHWrhttps://www.blocktrail.com/tBTC/address/mkwLg4ARNWimVW1Bh9uxv9SKdfNnPHRHWr0
So it seems that bitcoin returns the wrong balance of 1.02 instead of 0.01.