Author

Topic: [BOUNTY] Really annoying balance issue (Read 1673 times)

legendary
Activity: 1372
Merit: 1008
1davout
May 18, 2012, 04:15:56 AM
#12
You can create a new, empty wallet and use eg pywallet to extract the private keys from your old wallet and import them into your new wallet. Try it with just a few keys (or one only) first, use that temporary wallet with a rescan and send the coins to another new wallet.
That's exactly what I did to create this wallet, I took a big bunch of keys, imported them all, and then let the client download/scan the chain.
I very strongly suspect the issue is somehow related to imported keys (as opposed to those generated directly by the client).

davout, it appears people aren't receiving all the bitcoins they're supposed to. Could it be related to this problem? http://www.reddit.com/r/Bitcoin/comments/ts6ak/instawallet_lost_5_of_my_deposit/
That can happen when the site is down for maintenance, bitcoind receives the coins, but the part where it notifies the backend DB doesn't work. What I usually do in these cases is force a rescan of the events that happened during the time the backend was offline.

Thank god most people aren't like the person posting this reddit thread and don't start spreading FUD if don't get an instantaneous reply from the support.
member
Activity: 97
Merit: 10
davout, it appears people aren't receiving all the bitcoins they're supposed to. Could it be related to this problem? http://www.reddit.com/r/Bitcoin/comments/ts6ak/instawallet_lost_5_of_my_deposit/

hero member
Activity: 576
Merit: 514
using a new wallet implies that I can transfer the coins which the client won't let me do since it will check what I try to send against getbalance (it won't let me transfer all the coins)
You can create a new, empty wallet and use eg pywallet to extract the private keys from your old wallet and import them into your new wallet. Try it with just a few keys (or one only) first, use that temporary wallet with a rescan and send the coins to another new wallet.

Should work to get around this problem; however, a fix of the source to avoid that would be nice.

Also, not seeing the source/destination address in a transfer to yourself is not helpful either.
legendary
Activity: 1372
Merit: 1008
1davout
Looking at the code a little, it might be possible that you have unconfirmed transactions.  Did you delete all the transactions in the wallet before rescanning?

If it is not that, then I'm lost.
I do not, the balance reported by "getbalance '*' 1" is much bigger than what getbalance reports (the calls should theoretically be equivalent), that means the transactions counted have at least one conf.
It's logical that "getbalance '*' 0" reports a bigger balance than "getbalance '*' 1" though.

Update it, and rescan for transactions. If that doesn't work try using a new wallet all together
Update is irrelevant, rescan was done long before I even thought about posting on the forums, using a new wallet implies that I can transfer the coins which the client won't let me do since it will check what I try to send against getbalance (it won't let me transfer all the coins)
legendary
Activity: 1470
Merit: 1002
Hello!
Update it, and rescan for transactions. If that doesn't work try using a new wallet all together
member
Activity: 61
Merit: 10
Looking at the code a little, it might be possible that you have unconfirmed transactions.  Did you delete all the transactions in the wallet before rescanning?

If it is not that, then I'm lost.
hero member
Activity: 576
Merit: 514
I can't really offer a fix, but I ran into the same problem: https://bitcointalksearch.org/topic/bug-wrong-balance-displayed-81473

Perhaps it's possible to narrow down the cause. For me, the bug appeared when I played around with im/exporting keys. Everything was perfectly fine until the client picked up confirmations for the "to self" transaction.
legendary
Activity: 1372
Merit: 1008
1davout
I'll bounty 2 BTC for a workaround and 10 BTC for a fix.
legendary
Activity: 1372
Merit: 1008
1davout
Code:
$ ./bitcoin getinfo
{
    "version" : 60099,
    "protocolversion" : 60000,
    "walletversion" : 60000,
    "balance" : 698.57338016,
    "blocks" : 180489,
    "connections" : 8,
    "proxy" : "",
    "difficulty" : 1733207.51384839,
    "testnet" : false,
    "keypoololdest" : 1337242670,
    "keypoolsize" : 1001,
    "paytxfee" : 0.00000000,
    "errors" : "URGENT: upgrade required, see http://bitcoin.org/dos for details"
}

$ ./bitcoin getbalance
698.57338016

$ ./bitcoin getbalance '' 0
2883.11218472

$ ./bitcoin getbalance '' 1
2413.11218472

$ ./bitcoin listaccounts
{
    "" : 2413.11218472
}

$ ./bitcoin getbalance '*' 0
2883.11218472

$ ./bitcoin getbalance '*' 1
2413.11218472

Ok, so what I conclude is the following : there is apparently a bug in getbalance (called without additional arguments), that prevents it from reporting the correct balance. I assume that calling getbalance and passing an account yields the correct balances (I track them separately in a RDBMS).

Since I don't use accounts getbalance '' X and getbalance '*' X logically yield the same result.

This is very frustrating, if it is confirmed to be a bug in bitcoind (I suspect it's linked with this bug) then I think its priority should be bumped a fair bit since it prevents sending valid funds.

Any insight, idea or suggestion from the friendly Bitcoin community will be very appreciated!
legendary
Activity: 1372
Merit: 1008
1davout
It seems that you are just using the 'getbalance' command wrong, don't put "'*' 0" at the end.

like this:
bitcoin getbalance


You might be missing transactions so try running:
bitcoin -rescan
then:
bitcoin listaccounts
I did rescan a couple of times already, and I'm using the getbalance command correctly.
But thank you for showing some interest, it is appreciated Smiley

EDIT : Using listaccounts is a good suggestion actually, gives some more insight, results posted below
member
Activity: 61
Merit: 10
It seems that you are just using the 'getbalance' command wrong, don't put "'*' 0" at the end.

like this:
bitcoin getbalance


You might be missing transactions so try running:
bitcoin -rescan
then:
bitcoin listaccounts


legendary
Activity: 1372
Merit: 1008
1davout
Code:
$ ./bitcoin getinfo
{
    "version" : 60099,
    "protocolversion" : 60000,
    "walletversion" : 60000,
    "balance" : 62.10626016,
    "blocks" : 180481,
    "connections" : 8,
    "proxy" : "",
    "difficulty" : 1733207.51384839,
    "testnet" : false,
    "keypoololdest" : 1337234612,
    "keypoolsize" : 1001,
    "paytxfee" : 0.00000000,
    "errors" : "URGENT: upgrade required, see http://bitcoin.org/dos for details"
}

(Gonna do the upgrade later, don't think it has anything to do with my problem.)

Code:
$ ./bitcoin getbalance '*' 0
1810.91340447

$ ./bitcoin getbalance '*' 1
1776.64506472

The correct value should be the one that getbalance yields.
What could be happening here ?? This is driving me seriously crazy.
Jump to: