Bitcoin Forum
November 11, 2024, 03:04:17 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [BUG] Wrong balance displayed  (Read 1267 times)
Bitsky (OP)
Hero Member
*****
Offline Offline

Activity: 576
Merit: 514


View Profile
May 12, 2012, 02:00:28 PM
 #1

I've been playing around with pywallet and dumped a private key of one of my addresses. Then I imported it into a brand new wallet and ran a rescan which worked just fine. From that wallet, I sent everything to a new address in my main wallet (via the newest client), closed the client and started my old client with a rescan again which ended up with a "Payment to yourself" entry. Looking at the transaction details, the debit and credit values are identical, without any fees.

At that point I noticed that my balance was less than before.

So I started a XP machine without network and opened the backup wallet and the current wallet in the 0.6.2 client (without a blockchain). The difference is exactly 0.018btc.

To investigate this, I exported all transactions of both wallets into two csv files, opened them in a spreadsheet and summed up the transactions: both results are identical, not missing the 0.018btc.

It seems like the client has a bug when it sums up transactions which contain a transaction to yourself. Also, it does not display the receiving address/account, making it impossible to keep track of the target. Even if I search for the address I sent the coins to in the transaction list there are no results. However blockexplorer.com/blockchain.info show the address; it would be really handy to have the official client diplay it too.

Bounty: Earn up to 68.7 BTC
Like my post? Feel free to drop a tip to 1BitskyZbfR4irjyXDaGAM2wYKQknwX36Y
SomeoneWeird
Hero Member
*****
Offline Offline

Activity: 700
Merit: 500


View Profile
May 12, 2012, 02:18:10 PM
 #2

I've been playing around with pywallet and dumped a private key of one of my addresses. Then I imported it into a brand new wallet and ran a rescan which worked just fine. From that wallet, I sent everything to a new address in my main wallet (via the newest client), closed the client and started my old client with a rescan again which ended up with a "Payment to yourself" entry. Looking at the transaction details, the debit and credit values are identical, without any fees.

At that point I noticed that my balance was less than before.

So I started a XP machine without network and opened the backup wallet and the current wallet in the 0.6.2 client (without a blockchain). The difference is exactly 0.018btc.

To investigate this, I exported all transactions of both wallets into two csv files, opened them in a spreadsheet and summed up the transactions: both results are identical, not missing the 0.018btc.

It seems like the client has a bug when it sums up transactions which contain a transaction to yourself. Also, it does not display the receiving address/account, making it impossible to keep track of the target. Even if I search for the address I sent the coins to in the transaction list there are no results. However blockexplorer.com/blockchain.info show the address; it would be really handy to have the official client diplay it too.


Make sure you have all the blocks in your client.
Bitsky (OP)
Hero Member
*****
Offline Offline

Activity: 576
Merit: 514


View Profile
May 12, 2012, 02:28:57 PM
 #3

Make sure you have all the blocks in your client.
Blockcount doesn't really matter. As said, I checked without a blockchain and network access. The sums are just listed as unconfirmed instead.

Bounty: Earn up to 68.7 BTC
Like my post? Feel free to drop a tip to 1BitskyZbfR4irjyXDaGAM2wYKQknwX36Y
SomeoneWeird
Hero Member
*****
Offline Offline

Activity: 700
Merit: 500


View Profile
May 12, 2012, 03:32:41 PM
 #4

Make sure you have all the blocks in your client.
Blockcount doesn't really matter. As said, I checked without a blockchain and network access. The sums are just listed as unconfirmed instead.

It does matter.
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2301


Chief Scientist


View Profile WWW
May 12, 2012, 03:52:00 PM
 #5

Do you get different answers for 'getbalance'  versus 'getbalance "*"' ?

There is a longstanding issue with they way unconfirmed transactions are counted that might be the source of your problem:
  https://github.com/bitcoin/bitcoin/issues/172

How often do you get the chance to work on a potentially world-changing project?
Bitsky (OP)
Hero Member
*****
Offline Offline

Activity: 576
Merit: 514


View Profile
May 12, 2012, 05:18:44 PM
 #6

Do you get different answers for 'getbalance'  versus 'getbalance "*"' ?
getbalance() returns the wrong balance, lacking 0.018btc in my case
getbalance("*") returns the correct value, just like summing everything up in a spreadsheet does

Quote
getbalance and getbalance '*' can return different amounts for 0-confirmation transactions, because of the way change transactions are counted.
However, the blockchain is up to date and the transaction is confirmed.

Since I wasn't too clear about it in my first post, I sent more than the 0.018btc. Sorry if that caused a confusion.

Is "(n/a)" instead of the target address in the transaction window normal?

Bounty: Earn up to 68.7 BTC
Like my post? Feel free to drop a tip to 1BitskyZbfR4irjyXDaGAM2wYKQknwX36Y
SomeoneWeird
Hero Member
*****
Offline Offline

Activity: 700
Merit: 500


View Profile
May 13, 2012, 12:43:23 AM
 #7

Do you get different answers for 'getbalance'  versus 'getbalance "*"' ?
getbalance() returns the wrong balance, lacking 0.018btc in my case
getbalance("*") returns the correct value, just like summing everything up in a spreadsheet does

Quote
getbalance and getbalance '*' can return different amounts for 0-confirmation transactions, because of the way change transactions are counted.
However, the blockchain is up to date and the transaction is confirmed.

Since I wasn't too clear about it in my first post, I sent more than the 0.018btc. Sorry if that caused a confusion.

Is "(n/a)" instead of the target address in the transaction window normal?

I'm not really sure about how the different accounts in a wallet work but maybe that's your problem.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!