spesmilo / electrum

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

fee calculation bug #5675

Open LukAss741 opened 4 years ago

LukAss741 commented 4 years ago

Look at attached screenshot. I had 0.02032916 BTC on my address and wanted to send 0.0203277 BTC with 1 sat/B fee to another address but electrum threw "Insufficient funds". After I replaced amount to send with ! then electrum prefilled 0.0203278 which is 1 sat more than what I wanted to send but despite that it allowed me to sign and broadcast this transaction. Note that I use trezor with P2SH address and sent funds to P2PKH address. trezor

AbdussamadA commented 4 years ago

I'm guessing it won't let you send the smaller amount because it'll create change and change adds one more output to the transaction which increases the transaction size and that means higher fees which you can't afford given the input you are using.

edit: actually it should be spending the change as part of the fees instead of creating a dust output. so may be it could be improved.

LukAss741 commented 4 years ago

It wouldn't generate any change. Any potential change would be less than dust limit. I couldn't get to preview as after clicking preview it throws "Insiffucient funds". It is bug that can be reproduced. It happens to me often when I want to sent exact amount with exact fee through my address.

AbdussamadA commented 4 years ago

have you tried changing the fee amount manually to cover the difference?

AbdussamadA commented 4 years ago

you know i'm not able to reproduce this. it's automatically increasing the fee instead of creating dust output.

Edit: I'd like to clarify that I don't have a trezor so just used a software wallet. So I wasn't able to properly test this.

LukAss741 commented 4 years ago

have you tried changing the fee amount manually to cover the difference?

I am not sure. I will try that next time it occurs.

you know i'm not able to reproduce this. it's automatically increasing the fee instead of creating dust output.

It might not occur 100% of the time but it happens regularly. I also use trezor with p2sh addresses which may be related to this issue since I noticed fee in electrum isn't accurate with p2sh address because it calculates fee for bech32 instead.

LukAss741 commented 4 years ago

have you tried changing the fee amount manually to cover the difference?

I just tried it. It also throws insufficient funds message box.