spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.39k stars 3.07k forks source link

Possible bug: Balance incorrect when doing "Sweep" from different sources #6239

Closed uFire closed 4 years ago

uFire commented 4 years ago

Hello

Today I decided to consolidate coins from my paper wallet addresses and a few addresses from within the Electrum wallet itself to the unused target address I got in the "Receive" tab. I have exported a WIF privkeys from five addresses by going to the "Address" tab, right-clicking selected address and selecting "Private key". Then I put them together with four WIF keys of my paper wallets I had generated outside of Electrum into the "Wallet->Private keys->Sweep" window. After I completed the sweep, no new transaction appeared in the main window and no address balances were changed within the "Address" tab, but in fact the transaction were accepted by blockchain and got confirmed.

Version: Electrum 3.3.8 OS: Windows 10 x64 All involved addresses are p2pkh

Seems like there some unexpected behavior when doing "Sweep" using WIFs of the internal and external addresses together.

Hope this helps.

SomberNight commented 4 years ago

no new transaction appeared in the main window and no address balances were changed within the "Address" tab, but in fact the transaction were accepted by blockchain and got confirmed.

:O that sounds weird Did this persist even after restarting the application?

uFire commented 4 years ago

Yes, there is no new transaction even after restarting. Even the target address I sent that "sweep" to still indicating that it is empty and has zero transactions, but in fact it did received all the funds.

The next step I did is got its WIF privkey and made a one more "Sweep" from that address to the new unused one - this transaction appeared in the history, everything went ok, BUT the overall balance is higher than supposed to be - higher exactly by the amount sum of the five internal addresses I made the "sweep" in the first post of this thread. And all five addresses still indicating positive balance but in fact they are empty. Also, The target address from the first sweep still indicating zero balance and zero transactions and still listed as unused.

There were one strange thing that took my attention. I had three wallets open, next to each other, all of them connected to my local ElectrumX 1.14.0 server. When I executed the first sweep, all of them updated simultaneously, like if there new block generated - there were spinning arrows in place of the green dot for a second. I made a lot of sweep operations in the past and never seen such behavoir. I even checked at the blockchain explorer - no new blocks were found the time I were making a sweep.

I think that if I recover the wallet from the secret words sequence, I will see the correct balance - total and for each particular address. But anyways, seems like there some glich when performing a "sweep" using internal and external addresses together.

Sorry for my bad English - I hope you get me right :)

UPDATE: I had some doubts and checked the first "target" address - I've mistaken. It is listed under used filter but has zero transactions. How this can be?? Annotation 2020-06-18 151834

uFire commented 4 years ago

Well, seems like I found the problem and it is not because of Electrum but ElectrumX server. Those paper wallets I used to sweep in the first step has hundreds of dust inputs (I have experimented with them many years) and their total size were more than 200 kilobytes, so it exceeded the ElectrumX's max_send parameter. So Electrum created and broadcasted the transaction successfully but ElectrumX were unable to return it back to Electrum and that caused such effect.

I have increased the max_send value and now everything is ok and the missing transaction is appeared in the history tab and all figures correct now.