When using Bitcoin version v0.13.99.0-86f9e3d compiled myself with libdb 5.3 on Debian Jessie, AMD64, the balances reported by listaccounts become inconsistent:
$ bitcoin-cli listaccounts | grep -v \ 0.00000000 { "": -27.58320234, "PP": 4.00584319, } $ bitcoin-cli getbalance 9.43349050
When reverting back to an older version (Bitcoin version v0.11.99.0-32520bf-dirty), the balance becomes correct again:
$ bitcoin-cli listaccounts | grep -v \ 0.00000000 { "": 5.32762789, "PP": 4.10586261, }
The sum equals my total balance.
This happens on AMD64. I tried compiling the the same version on an armv7l CPU, using approximately the same wallet (from an older backup), and the balances there are reported correctly. Either the inconsistency has shown up later, or due to using this wallet backup on the ARM for some transaction during downtime on the AMD64.
I get most of my incoming BTC to other accounts, and move them to "" when paid for.
I have rolled git back and forward in a tedious search for the exact commit causing this bug. I found that the bug is not present at 1b5118bfa0d94dbc0f3d7803c3e68626b0a694ee, but shows up at the next commit: 30c2d8c635c41149b7184ea8471121c53042444c. This is a merge of pull request #7105.
Something in pull request #7105 is causing the sum of account balances to become wrong, possibly only when it discovers outgoing wallet transactions created on a different node.