Alex Beckenham (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 22, 2011, 02:42:10 PM |
|
Please imagine the following scenario:
I have a new wallet on device A which I receive 2 transactions:
12 BTC 8 BTC
So my balance is 20 BTC.
I then copy that wallet.dat to an installation on device B.
From device B, I spend exactly 8 BTC, leaving a balance of 12 BTC (I assume this spend should come directly from the address that received 8 BTC so 'change' will not be an issue).
Let's say this 8 BTC spend gets old and has many confirmations.
Now, I go back to device A, which still shows a total balance of 20 BTC.
I then 'spend' the whole 20 BTC, dropping the balance to 0.00 in the client display.
This transaction should never be confirmed as 8 of it is a double spend, so my question is:
How to get the 12 legitimate coins back from this state of limbo and back into my balance?
|
|
|
|
Gareth Nelson
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 22, 2011, 02:58:53 PM |
|
Please imagine the following scenario:
I have a new wallet on device A which I receive 2 transactions:
12 BTC 8 BTC
So my balance is 20 BTC.
I then copy that wallet.dat to an installation on device B.
From device B, I spend exactly 8 BTC, leaving a balance of 12 BTC (I assume this spend should come directly from the address that received 8 BTC so 'change' will not be an issue).
Let's say this 8 BTC spend gets old and has many confirmations.
Now, I go back to device A, which still shows a total balance of 20 BTC.
I then 'spend' the whole 20 BTC, dropping the balance to 0.00 in the client display.
This transaction should never be confirmed as 8 of it is a double spend, so my question is:
How to get the 12 legitimate coins back from this state of limbo and back into my balance?
You go back to device A, the client figures out your current balance from the blockchain, not from wallet.dat and it shows 12BTC
|
|
|
|
theboos
Member
![*](https://bitcointalk.org/Themes/custom1/images/star.gif)
Offline
Activity: 87
Merit: 10
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 22, 2011, 03:01:04 PM |
|
The coins aren't in limbo. Such a transaction would not be accepted by the network so your 12 BTC is still usable in another valid transaction.
|
|
|
|
Pieter Wuille
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 22, 2011, 03:18:51 PM |
|
Please imagine the following scenario:
I have a new wallet on device A which I receive 2 transactions:
12 BTC 8 BTC
So my balance is 20 BTC.
I then copy that wallet.dat to an installation on device B.
From device B, I spend exactly 8 BTC, leaving a balance of 12 BTC (I assume this spend should come directly from the address that received 8 BTC so 'change' will not be an issue).
Let's say this 8 BTC spend gets old and has many confirmations.
Now, I go back to device A, which still shows a total balance of 20 BTC.
It won't. It will see the spend on the network, and add a corresponding spending transaction to the wallet, bringing the balance to 12 BTC. I then 'spend' the whole 20 BTC, dropping the balance to 0.00 in the client display.
This transaction should never be confirmed as 8 of it is a double spend, so my question is:
How to get the 12 legitimate coins back from this state of limbo and back into my balance?
If you do manage to spend the 20 BTC from B, without it having noticed the spend by A, you've indeed brought you wallet in a corrupted state, since it contains a transaction that conflicts with the block chain. It's possible to detect this conflict (I wrote a patch for that), but it's not yet merged in mainline bitcoin.
|
I do Bitcoin stuff.
|
|
|
Alex Beckenham (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 22, 2011, 03:35:00 PM |
|
Well, the above scenario appears to have happened to me.
I'll try to gather real-life details shortly... m0Ray was helping out with it in another thread.
|
|
|
|
Alex Beckenham (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 22, 2011, 03:35:56 PM |
|
The coins aren't in limbo. Such a transaction would not be accepted by the network so your 12 BTC is still usable in another valid transaction.
Yes, but the client instantly deducts the 20 as soon as it says "payment sent"... long before the network has a chance to see that it's invalid. So the client says 0.00 even though only 8 out of 20 was a double spend. Maybe I do have a corrupt wallet.dat (or several). I'm not ruling that out.
|
|
|
|
Gareth Nelson
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 22, 2011, 03:49:06 PM |
|
try the -rescan parameter?
|
|
|
|
Alex Beckenham (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 22, 2011, 03:53:05 PM |
|
try the -rescan parameter?
Thanks. Tried rescan. Tried upgrading client. Tried new block chain. The above figures were examples only, but I'm basically out 12 btc at this point ![Sad](https://bitcointalk.org/Smileys/default/sad.gif) I think what I might do is just not touch them for a few days and see if it works itself out. p.s. This is all home pc stuff... none of this affects the wallet on bitcointoss.com or flipforbits.com.
|
|
|
|
Pieter Wuille
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 22, 2011, 03:58:24 PM |
|
The coins aren't in limbo. Such a transaction would not be accepted by the network so your 12 BTC is still usable in another valid transaction.
Yes, but the client instantly deducts the 20 as soon as it says "payment sent"... long before the network has a chance to see that it's invalid. So the client says 0.00 even though only 8 out of 20 was a double spend. Maybe I do have a corrupt wallet.dat (or several). I'm not ruling that out. If you're able to build from source and trust me, you can try https://github.com/sipa/bitcoin/tree/rejectedtx. It will detect transactions that conflict with the block chain, and mark them inactive. Make sure you have a backup of wallet.dat, though.
|
I do Bitcoin stuff.
|
|
|
m0Ray
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 22, 2011, 03:59:19 PM |
|
The coins aren't in limbo. Such a transaction would not be accepted by the network so your 12 BTC is still usable in another valid transaction.
Yes, but the client instantly deducts the 20 as soon as it says "payment sent"... long before the network has a chance to see that it's invalid. ... Maybe I do have a corrupt wallet.dat (or several). Quite right. The problem of "hung" transactions in wallet.dat becomes annoying. For myself I wrote a simple utility, but it needs compilation and so is not suitable for ordinary users. Tomorrow I'll (maybe) try to implement "full rescan" patch to bitcoin. Going asleep today.
|
|
|
|
|
m0Ray
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 22, 2011, 04:01:23 PM |
|
Yet another utility for the same problem. ![Wink](https://bitcointalk.org/Smileys/default/wink.gif) We definitely need a "full rescan" option.
|
|
|
|
m0Ray
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 22, 2011, 04:03:00 PM |
|
Great! Now I can sleep peacefully. ![Wink](https://bitcointalk.org/Smileys/default/wink.gif)
|
|
|
|
Pieter Wuille
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 22, 2011, 04:04:27 PM |
|
By the way, the "full rescan" I suggested/implemented does not remove transactions from the wallet, only adds/updates them, so it's not a solution for doood's problem.
|
I do Bitcoin stuff.
|
|
|
Alex Beckenham (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 22, 2011, 04:08:02 PM |
|
The coins aren't in limbo. Such a transaction would not be accepted by the network so your 12 BTC is still usable in another valid transaction.
Yes, but the client instantly deducts the 20 as soon as it says "payment sent"... long before the network has a chance to see that it's invalid. ... Maybe I do have a corrupt wallet.dat (or several). Quite right. The problem of "hung" transactions in wallet.dat becomes annoying. For myself I wrote a simple utility, but it needs compilation and so is not suitable for ordinary users. Tomorrow I'll (maybe) try to implement "full rescan" patch to bitcoin. Going asleep today. Your "full rescan" sounds like it could be exactly what's needed... Will definitely pay you for it, although I'm lost when it comes to compiling C...
|
|
|
|
theymos
Administrator
Legendary
Offline
Activity: 5306
Merit: 13296
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 23, 2011, 06:46:07 AM |
|
You can just restore your wallet from a backup.
|
1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
|
|
|
Alex Beckenham (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 23, 2011, 06:54:17 AM |
|
You can just restore your wallet from a backup.
The problem extends there for me unfortunately as I backed up too soon after doing this, overwriting my oooold backup. Whoops. Will keep these 'empty' wallets for later as an unintended savings account, until the day I can extract the legit coins out of them.
|
|
|
|
m0Ray
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 23, 2011, 09:44:51 AM |
|
Added a pull request for "-purgetx" option. Works for me.
|
|
|
|
Alex Beckenham (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 23, 2011, 11:08:59 AM |
|
Added a pull request for "-purgetx" option. Works for me.
Awesome. If someone wants to expedite a win32 binary, I'll pay for it (+ btc to m0Ray) ![Cheesy](https://bitcointalk.org/Smileys/default/cheesy.gif)
|
|
|
|
Alex Beckenham (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 27, 2011, 04:21:00 PM |
|
Added a pull request for "-purgetx" option.
Sorry I still don't know what a 'pull request' is although I've seen the term floating around this forum. Is this -purgetx likely to end up in the official client any time soon or should I find it elsewhere? I'm in the process right now of learning a little more linux; just downloaded ubuntu livecd.
|
|
|
|
|