bitcoin-abc: Wrong balances on accounts

Balances shown in getbalance <account_name> and listaccounts are wrong.

How to reproduce

  1. Generate a new address on a new account
  2. Send funds to said address
  3. No funds shown on listaccounts

Expected behaviour

Address’s balance shown

Actual behaviour

0.00000000

What version of bitcoin-abc are you using?

“version”: 170100, “protocolversion”: 70015, “walletversion”: 160300

Machine specs:

  • OS: Debian 9
  • CPU: 2 vCPU
  • RAM: 4GB

Extra information

bitcoin-cli getreceivedbyaddress qrk68edsw6tykejv6rht6mjx5szyuya2dgtrkkjmev

0.00050000

bitcoin-cli getaccount qrk68edsw6tykejv6rht6mjx5szyuya2dgtrkkjmev

8eb6cf62a73755d7f254d687610fd162b313c243c019a33b386343b242438e46

bitcoin-cli getbalance 8eb6cf62a73755d7f254d687610fd162b313c243c019a33b386343b242438e46

0.00000000

But the balance is right there: https://blockdozer.com/address/bitcoincash:qrk68edsw6tykejv6rht6mjx5szyuya2dgtrkkjmev

This is then causing another bug that when sending the money from this account, with sendmany funds are sent from another account instead (I guess because this one shows up as not having funds), and that is not the intended behaviour.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 27 (4 by maintainers)

Most upvoted comments

Did you mean inputs?

No, I mean outputs. The coin selector chooses unspent transaction outputs to be used as inputs.

What is scheduled to replace it?

Nothing is. There is no plan to replace the account system.

Will there be a way to say “debit from this address”?

Use the coin control features. If you want to “send from” certain addresses, then you must use the coin control features. You can specify the specific outputs that you want to spend (you cannot specify by address, only by output reference, so txid and output index). You can use lockunspent to prevent the spending of certain outputs. So you would lock the outputs for addresses that you do not want to “spend from” so the coin selector only choose outputs of the addresses that you want to “spend from”.

Alternatively, use createrawtransaction and construct the transactions yourself.

@dwjorgeb - whenever you feel the time is right, please close this issue as soon as possible. I am concerned of the potential numerous email notifications that are/could be going out to all the other developers, on every reply we make here.

@achow101 the issue with lockunspent is that it is memory-based, so it will be wiped out if the node restarts.

the createrawtransaction might be a way, but it involves much more work, like signing. Might be something worth looking at, thanks!

@achow101 I see, but that is not how Bitcoin Core works. I have the same sendmany and it sends the transaction from the address on that account. I have hundreds of transactions out of my wallet and just checked some of them randomly it matches…

If I’m saying an address belongs to an account when generating said address and then I say that account should be debited from makes no sense to debit an address that belongs to another account.

But I’ll make a script to go through all the TXs on Bitcoin Core and check all the addresses, to see if the same is happening there