Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Tril on April 30, 2011, 11:53:42 PM



Title: wallet glitched
Post by: Tril on April 30, 2011, 11:53:42 PM
I have a tx showing 0/unconfirmed, which won't change even if I use -rescan.

Here's what I did:

1. send tx
2. immediately quit bitcoin
3. move wallet.dat aside, replace with a different one
4. run bitcoin. The tx doesn't appear, as expected
5. wait for a new block-  tx appears with 1 confirmation (since this wallet is the recipient)
6. quit bitcoin
7. put original wallet.dat back.
8. tx still stuck at 0/unconfirmed. all other tx have confirmations increasing. -rescan has no effect.

This seems to be a bug, since rescan should work.


Title: Re: wallet glitched
Post by: error on May 01, 2011, 12:01:46 AM
Pretty soon someone knowledgeable is going to come along and say:

"Run bitcoin -debug, double click the transaction, and paste the contents of the Transaction Details window."


Title: Re: wallet glitched
Post by: riX on May 01, 2011, 12:12:57 AM
Or you could check if the transaction made it into the blockchain on blockexplorer.com..


Title: Re: wallet glitched
Post by: Tril on May 01, 2011, 12:48:32 AM
I fixed this by restoring a copy of wallet.dat from before I made the tx in question, then running -rescan.  I would still like to know if there's a reason for the behavior I saw. It seems from the warning at http://sourceforge.net/projects/bitcoin/files/Bitcoin/blockchain/ (from the README.txt), that wallets with unprocessed transactions have known issues.


Title: Re: wallet glitched
Post by: casascius on May 01, 2011, 12:52:05 AM
I had the same thing, I recovered by deleting the databases (but not wallet.dat) and then running bitcoin, telling it to connect to another node on my network running bitcoin, so it could redownload the whole block chain without sapping my internet connection.


Title: Re: wallet glitched
Post by: randomguy7 on May 01, 2011, 01:20:55 AM
How can you make it connect to some specific node? Thats exactly what I need right now :)


Title: Re: wallet glitched
Post by: theymos on May 01, 2011, 01:23:12 AM
I think it's a rescan bug.


Title: Re: wallet glitched
Post by: casascius on May 01, 2011, 02:19:23 AM
How can you make it connect to some specific node? Thats exactly what I need right now :)

there is a command line option

type bitcoin -? for help

I believe it's -connect=xxx.xxx.xxx.xxx


Title: Re: wallet glitched
Post by: Tril on May 01, 2011, 05:39:10 AM
How can you make it connect to some specific node? Thats exactly what I need right now :)

there is a command line option

type bitcoin -? for help

I believe it's -connect=xxx.xxx.xxx.xxx

-connect= is correct.  Add -nolisten=1 (which implies -noirc=1) if you don't want other connections either.

From my experience, having only one connection is bad if you're using the wallet with any miners. Bitcoin
often disconnects from peers and incorrectly displays it has a connection, so you'll be behind on the tx pool
quite a bit.  Try to have at least 8 peers when mining!  Also, it's faster to download new blocks
if you have more than 1 peer, since that peer will sometimes throttle/disconnect you.  If you're just
updating blocks and not mining, one peer will work if you're patient, since it will keep retrying.


Title: Re: wallet glitched
Post by: Pieter Wuille on May 01, 2011, 08:42:17 AM
I have a tx showing 0/unconfirmed, which won't change even if I use -rescan.

Here's what I did:

1. send tx
2. immediately quit bitcoin
3. move wallet.dat aside, replace with a different one
4. run bitcoin. The tx doesn't appear, as expected
5. wait for a new block-  tx appears with 1 confirmation (since this wallet is the recipient)
6. quit bitcoin
7. put original wallet.dat back.
8. tx still stuck at 0/unconfirmed. all other tx have confirmations increasing. -rescan has no effect.

This seems to be a bug, since rescan should work.

Strange indeed, this shouldn't happen. And it definitely shouldn't remain after a rescan. Couple of questions though:
* which version of bitcoin are you using
* you say "since this wallet is the recipient", so you're using an address from the new wallet as destination for a tx from the old one?
* did you only move wallet.dat aside, or the whole datadir?


Title: Re: wallet glitched
Post by: FreeMoney on May 01, 2011, 01:23:04 PM
This happened to me too.


Title: Re: wallet glitched
Post by: Tril on May 02, 2011, 03:24:45 PM

Strange indeed, this shouldn't happen. And it definitely shouldn't remain after a rescan. Couple of questions though:
* which version of bitcoin are you using

The problem originally occurred in 0.3.20.2 and I upgraded to 0.3.21 to see if it would fix the problem, and it didn't.  I rescanned in both with no effect.

Quote from: sipa
* you say "since this wallet is the recipient", so you're using an address from the new wallet as destination for a tx from the old one?

yes

Quote from: sipa
* did you only move wallet.dat aside, or the whole datadir?

I only moved wallet.dat aside.



Title: Re: wallet glitched
Post by: Alex Beckenham on May 22, 2011, 11:53:13 AM
I've got this problem too... deleted everything in the data dir except for:

wallet.dat
blk0001.dat
blkindex.dat

restarted bitcoin with:

bitcoin -addnode=x.x.x.x -rescan -debug

and it still tells me the following is 0/unconfirmed:

Quote
(Uuuh, actually, copy+paste has never worked for me in the Transaction Details window on Windows XP client). I've tried Ctrl-C, Ctrl+Ins, drag-n-drop, right-clicking the text with the mouse... nothing will copy it to the clipboard.



Title: Re: wallet glitched
Post by: Alex Beckenham on May 22, 2011, 12:01:52 PM
https://i.imgur.com/2yw18.png

All of these (inputs+outputs) are in blocks as shown by blockexplorer.com.


Title: Re: wallet glitched
Post by: m0Ray on May 22, 2011, 12:04:35 PM
Try using this code to delete all transactions from wallet, then rescan:
http://m0ray.net/sites/default/files/bitcoin/bc_tx.tar.bz2

Deleting transaction from wallet, AFAIK, is not dangerous because all confirmed transactions are reconstructed during rescan.

Maybe this function must be included in bitcoin/bitcoind.


Title: Re: wallet glitched
Post by: theymos on May 22, 2011, 12:06:04 PM
You also need to delete blk0001.dat and blkindex.dat. I think this is a rescan bug.


Title: Re: wallet glitched
Post by: Alex Beckenham on May 22, 2011, 12:08:49 PM
You also need to delete blk0001.dat and blkindex.dat. I think this is a rescan bug.

Damn, really? I just re-downloaded it 2 days ago.

Perhaps it's the node that I'm adding that has a bad copy of it?

Could someone else give me a node to connect to so that I can be sure I'm not getting it from the aforementioned x.x.x.x?

Thanks.

p.s. Thanks for the code m0Ray, it'll be an interesting read, however I haven't compiled C since uni quite a few years ago now.


Title: Re: wallet glitched
Post by: theymos on May 22, 2011, 12:12:56 PM
If you already redownloaded after the problem developed, then doing it again probably won't help. You can't have gotten a bad copy, since Bitcoin checks the blocks before adding them to the database (unless you manually replaced the files).


Title: Re: wallet glitched
Post by: Pieter Wuille on May 22, 2011, 12:15:43 PM
You also need to delete blk0001.dat and blkindex.dat. I think this is a rescan bug.

You're right. -rescan only adds missing transactions to the wallet. It doesn't update wallet transactions with missing information from the block chain.

Maybe we need a separate -rescan-full, or change the meaning of -rescan to do this anyway, as a regular rescan is now done immediately anyway?


Title: Re: wallet glitched
Post by: Alex Beckenham on May 22, 2011, 12:16:32 PM
If you already redownloaded after the problem developed, then doing it again probably won't help. You can't have gotten a bad copy, since Bitcoin checks the blocks before adding them to the database (unless you manually replaced the files).

Okay uh, I just deleted the block chain before I read your post :P

Anyway, I was on 3.20 so I'm getting 3.21 now and obviously I'll be getting the block chain again.


Title: Re: wallet glitched
Post by: m0Ray on May 22, 2011, 12:27:30 PM
I'll try to compile it statically.


Title: Re: wallet glitched
Post by: Alex Beckenham on May 22, 2011, 02:18:00 PM
Okay, installed a fresh copy of 0.3.21, replaced wallet.dat with my old one and let it download the block chain to 125784.

And that transaction is finally showing as confirmed.


Now a separate issue... Could someone make sense of this one for me?

(Sorry, copying text from Transaction Details window still doesn't work in this version either).

https://i.imgur.com/zYhPx.png

This has also been unconfirmed for a long time, and it's not in a block yet (cite blockexplorer.com), but also not listed as unconfirmed on http://bitcoincharts.com/bitcoin/

That site normally lists any unconfirmed transactions that I search for, but not this one.

I'm wondering if somehow a double-spend has occurred and this will be unconfirmed forever. (This wallet balance is 0.00).   ...But how can you tell for sure if that is the case, or if I just need to wait longer for it to show up somewhere?

Thanks very much.



Title: Re: wallet glitched
Post by: m0Ray on May 22, 2011, 03:18:52 PM
This has also been unconfirmed for a long time, and it's not in a block yet (cite blockexplorer.com)
Then it's obviously unconfirmed and may stay unconfirmed forever.

but also not listed as unconfirmed on http://bitcoincharts.com/bitcoin/

That site normally lists any unconfirmed transactions that I search for, but not this one.
AFAIK, that site lists only transactions that network has to pack in next block. If your transaction did not reach the network, you can see it only in your client.
You may wait, but I suspect that client does not resend transactions that are unconfirmed for a long time.
Also you may delete it, rescan the block chain and retry the transaction (make sure that all recent blocks are downloaded and network connection is stable).


Title: Re: wallet glitched
Post by: Alex Beckenham on May 22, 2011, 03:39:49 PM
m0Ray, could you take a look at this for me if you haven't already:

https://forum.bitcoin.org/index.php?topic=9359.msg135110#msg135110

I guess I may need to delete transactions from the wallet as you suggest.


Title: Re: wallet glitched
Post by: theymos on May 22, 2011, 07:12:17 PM
I'm wondering if somehow a double-spend has occurred and this will be unconfirmed forever. (This wallet balance is 0.00).   ...But how can you tell for sure if that is the case, or if I just need to wait longer for it to show up somewhere?

That one is a double-spend. It will never clear.

You can see that the output referenced by your input was already spent here:
http://blockexplorer.com/tx/4a1934adf42ce45201f2c2e6193b852891afda989d959167578f15ec8a2a828e#o0


Title: Re: wallet glitched
Post by: m0Ray on May 23, 2011, 12:36:47 AM
I'm wondering if somehow a double-spend has occurred and this will be unconfirmed forever. (This wallet balance is 0.00).   ...But how can you tell for sure if that is the case, or if I just need to wait longer for it to show up somewhere?
That one is a double-spend. It will never clear.
Is double spend possible in bitcoin? If so, what we all are doing here?

You can see that the output referenced by your input was already spent here:
http://blockexplorer.com/tx/4a1934adf42ce45201f2c2e6193b852891afda989d959167578f15ec8a2a828e#o0
That 20BTC are "Not yet redeemed". So they must be on user's balance, but it is marked as spent only in user's wallet.dat.


Title: Re: wallet glitched
Post by: error on May 23, 2011, 12:42:18 AM
I'm wondering if somehow a double-spend has occurred and this will be unconfirmed forever. (This wallet balance is 0.00).   ...But how can you tell for sure if that is the case, or if I just need to wait longer for it to show up somewhere?
That one is a double-spend. It will never clear.
Is double spend possible in bitcoin? If so, what we all are doing here?

If it wasn't clear from context, he means that the double-spend failed.


Title: Re: wallet glitched
Post by: Alex Beckenham on May 23, 2011, 02:30:17 AM
Yeah and when I said "a double-spend has occurred", I meant "a double-spend was unwittingly attempted".