Bitcoin Forum

Bitcoin => Electrum => Topic started by: mocacinno on July 15, 2020, 09:52:23 AM



Title: 4.0.2 => edit fee => change address
Post by: mocacinno on July 15, 2020, 09:52:23 AM
I've searched a bit, but couldn't find this "missing feature" being described in an other topic (yet).

My environment:
Electrum 4.0.2 (downloaded from electrum.org, verified the sig)
Windows 10 (my employer forces me to use windows  ::))

Following settings:
https://i.imgur.com/gtzBVa3.png

Some background info: i try to empty out a wallet of mine... Completely empty it out (funds go to a safer hardware wallet).
So i want to use all unspent outputs funding addresses in my electrum wallet, create a transaction with a low fee (transfer between my own wallets, i do not need a confirmation that urgently) and the output of this transaction has to fund an address generated by my hardware wallet.

Step 1:
https://i.imgur.com/989C3K7.png
1) clicked the "send" tab
2) pasted the address generated by my hardware wallet
3) clicked on "max" (i want to empty out this wallet)
4) clicked on "pay"

Step 2:
https://i.imgur.com/bjKuYwM.png
That's nice and all... But i don't want to pay the 3.9 sat/byte fee that was proposed... I want to pay 1.1 sat/vbyte

step 3:
https://i.imgur.com/LEObuBB.png
OOOOOPS... If i manually decrease the fee, a change address gets generated... That's not what i wanted... I clicked on "max", i want my wallet empty AND i don't want to overspend on fees... I don't want a change address...

Now, before i get all kinds of suggestions... They're not needed... I have plenty of workaround and technical knowledge to solve this one all by myself... I just wanted to notify ThomasV (or other dev's that are working on electrum) there was a usecase that isn't completely covered with the 4.0.2 UI

In case somebody wants the workarounds:
  • downgrade to 3.3.8, this glitch did not exist, since the fee slider is placed earlyer in the tx creating process
  • use the console
  • export the private keys, use core or coinb.in to create the transaction


Title: Re: 4.0.2 => edit fee => change address
Post by: Rath_ on July 15, 2020, 09:58:49 AM
OOOOOPS... If i manually decrease the fee, a change address gets generated... That's not what i wanted... I clicked on "max", i want my wallet empty AND i don't want to overspend on fees... I don't want a change address... [...]

In case somebody wants the workarounds: [...]

There is no need for such workarounds. Decide which address should get the remaining funds from the decreased fee and instead of the amount, use exclamation mark ('!'). This will force Electrum to send all the remaining coins to that address. There should be a much easier way in the 'Advanced preview' not to create a change address, though.


Title: Re: 4.0.2 => edit fee => change address
Post by: HCP on July 15, 2020, 10:09:21 AM
Interestingly... I can't replicate this bug.

I just tested it with 2 different wallets (one on mainnet, one on testnet) and set it up to send all the funds using the max. If I adjust the fee slider it doesn't create any new outputs... it still only has the one output??!? ???

Also, the "change" address that your wallet is generating is highlighted in "green"... which neans that it is a "receive" address doesn't it? Is that wallet a "standard" wallet with seed etc, or imported with private keys? ???


Title: Re: 4.0.2 => edit fee => change address
Post by: mocacinno on July 15, 2020, 10:24:55 AM
There is no need for such workarounds. Decide which address should get the remaining funds from the decreased fee and instead of the amount, use exclamation mark ('!'). This will force Electrum to send all the remaining coins to that address. There should be a much easier way in the 'Advanced preview' not to create a change address, though.
Thanks for chipping in, but "deciding which address should get the remaining funds"? I have no idear where the gui would allow me to specify the exact change address... And even if it did allow this, i'd have to manually edit this value each time i wanted to clean out my wallet...

The exclamation mark results in following error:
https://i.imgur.com/FZ7x7jG.png

I know a long time ago, this was the way of emptying out your wallet, but it seems to be invalid in version 4.0.2, or at least, it shows an error..


Interestingly... I can't replicate this bug.

I just tested it with 2 different wallets (one on mainnet, one on testnet) and set it up to send all the funds using the max. If I adjust the fee slider it doesn't create any new outputs... it still only has the one output??!? ???

Also, the "change" address that your wallet is generating is highlighted in "green"... which neans that it is a "receive" address doesn't it? Is that wallet a "standard" wallet with seed etc, or imported with private keys? ???


It's a wallet with imported private keys, the change funded the same address whose unspent outputs i was spending... Maybe that's the difference... Also, i didn't use the slider, but rather manually entered the fee.

EDIT: tried a "normal" wallet, couldn't replicate the issue there either... It was either a glitch, something i did wrong, or it only happens with wallets with manually imported private keys...
I actually noticed this "bug" on 4.0.1, then upgraded to 4.0.2 and saw the exact same behaviour... That's why i opened this topic.


Title: Re: 4.0.2 => edit fee => change address
Post by: HCP on July 15, 2020, 10:47:33 AM
EDIT: tried a "normal" wallet, couldn't replicate the issue there either... It was either a glitch, something i did wrong, or it only happens with wallets with manually imported private keys...
I actually noticed this "bug" on 4.0.1, then upgraded to 4.0.2 and saw the exact same behaviour... That's why i opened this topic.
Very very odd. So, I tried with a wallet with imported keys and I still can't replicate it there either. Very strange... must be some little quirk with your setup/wallet that is causing it to happen??!? :-\


The exclamation mark results in following error:
You can't put the exclamation in the actual value box any more... that's what the "max" button is for... but you can put the ! mark in the "Pay to" field after the address:
https://talkimg.com/images/2023/11/15/zJ9ZC.png

But I honestly don't think that is going to change anything for you with regards to this particular issue... as far as I can tell, using the "!" is functionally the same as clicking the "max" button :-\


Title: Re: 4.0.2 => edit fee => change address
Post by: Rath_ on July 15, 2020, 10:59:48 AM
Thanks for chipping in, but "deciding which address should get the remaining funds"? I have no idear where the gui would allow me to specify the exact change address...

Oh, I didn't pay enough attention to 'Pay to' and thought that you were trying to spend coins to more than 1 address so I recommended putting exclamation mark in the amount of one of those addresses and not the change address.

I know a long time ago, this was the way of emptying out your wallet, but it seems to be invalid in version 4.0.2, or at least, it shows an error..

That's weird. It works fine with my wallet on Electrum 4.0.2. How did you fill out 'Pay to'? Since you knew about this feature, you probably did it right but just in case:

Code:
Address1, !


Title: Re: 4.0.2 => edit fee => change address
Post by: mocacinno on July 15, 2020, 11:27:01 AM

That's weird. It works fine with my wallet on Electrum 4.0.2. How did you fill out 'Pay to'? Since you knew about this feature, you probably did it right but just in case:

Code:
Address1, !

Nope,i did it wrong :)
In very old versions, you could enter the exclamation mark in the "value"-box, and that's what i tried...
It does, however, work in the "pay to"-box. It's a feature i very seldomly use, i had no idear the place where an "!" is accepted switched from the "amount"-box to the "pay to"-box.

I'll try to replicate the issue this evening, when i get back from work. But this case i'll use a better OS ;)


Title: Re: 4.0.2 => edit fee => change address
Post by: nc50lc on July 16, 2020, 02:55:53 AM
-snip-
1) clicked the "send" tab
2) pasted the address generated by my hardware wallet
3) clicked on "max" (i want to empty out this wallet)
4) clicked on "pay"

Step 2:
That's nice and all... But i don't want to pay the 3.9 sat/byte fee that was proposed... I want to pay 1.1 sat/vbyte

step 3:
OOOOOPS... If i manually decrease the fee, a change address gets generated... That's not what i wanted... I clicked on "max", i want my wallet empty AND i don't want to overspend on fees... I don't want a change address...
-snip-
I can't replicate this, I've done the same exact steps, same settings, same OS and no exclamation point.
The difference is I'm running from source, but the official v.4.0.2 release not a development version.

The 'to be sent' amount to the recipient address changes every-time I edit the fee (manually or through the slider)

Here's what it looks like at 6 sat/B:
https://i.imgur.com/C5baMdX.png (https://i.imgur.com/C5baMdX.png)
In case you don't have a magnifying lens: The last few satoshi digits of the amount is: 398104

When I edit it to 1.1 sat/B; there's no additional change address or rather receiving address (because yours is green):
https://i.imgur.com/CBz5l8l.png (https://i.imgur.com/CBz5l8l.png)
The last few digits is: 399652


Title: Re: 4.0.2 => edit fee => change address
Post by: pooya87 on July 16, 2020, 03:48:28 AM
i'm confused about why you refer to this as a bug where it is supposed to work this way!

lets take a look at what happens from the wallet's perspective.
your wallet sees a transaction from your wallet (addresses) to a new address that it does not recognize (it is not part of its address list). so the assumption is that you are making a payment for instance (like paying 50000 satoshi to buy a cup of coffee). when you decrease the fee, the wallet doesn't change the payment amount because if it did change it to 50500 then it will increase the coffee's cost. instead it creates a new address and sends the leftover there. hence the new 1321 sat green address in the final picture.

it doesn't matter if you clicked "Max" button, your wallet doesn't remember this (as far as i can tell from the code) and it shouldn't matter to it either. all it sees and remembers is this transaction with its inputs/outputs.


Title: Re: 4.0.2 => edit fee => change address
Post by: mocacinno on July 16, 2020, 05:32:31 AM
i'm confused about why you refer to this as a bug where it is supposed to work this way!

lets take a look at what happens from the wallet's perspective.
your wallet sees a transaction from your wallet (addresses) to a new address that it does not recognize (it is not part of its address list). so the assumption is that you are making a payment for instance (like paying 50000 satoshi to buy a cup of coffee). when you decrease the fee, the wallet doesn't change the payment amount because if it did change it to 50500 then it will increase the coffee's cost. instead it creates a new address and sends the leftover there. hence the new 1321 sat green address in the final picture.

it doesn't matter if you clicked "Max" button, your wallet doesn't remember this (as far as i can tell from the code) and it shouldn't matter to it either. all it sees and remembers is this transaction with its inputs/outputs.

hmm... If you re-read my posts, the only time i called it a bug was when i put the word bug between quotes... I called it a glitch, or a missing feature.
And that's what it was: a missing feature...
I do understand that, from the current workings of the wallet, this should be considered "normal". However, after somebody clicks the "max" button, i would expect the normal behavior to be that the wallet does remember the "max" button was clicked, and not to generate a change address... And that was exactly what i wanted to tell anybody who is actively involved in the development of electrum.

But, as it stands, i cannot replicate it anymore either... I have no idea what happened. Did it have something to do with the fact the average feerate was fluctuating quite heavily at that point in time, or something else? No idear, but i'm 100% certain above events did happen to me using 4.0.1 and 4.0.2, and i'm also sure i can no longer replicate these events.

I'll leave this topic open just in case somebody else is noticing the same behaviour in the future, and maybe some correlation between their case and mine can be found.


Title: Re: 4.0.2 => edit fee => change address
Post by: pooya87 on July 16, 2020, 09:59:23 AM
hmm... If you re-read my posts, the only time i called it a bug was when i put the word bug between quotes... I called it a glitch, or a missing feature.
sorry, that's what i meant ::)

Quote
And that's what it was: a missing feature...
I do understand that, from the current workings of the wallet, this should be considered "normal". However, after somebody clicks the "max" button, i would expect the normal behavior to be that the wallet does remember the "max" button was clicked, and not to generate a change address... And that was exactly what i wanted to tell anybody who is actively involved in the development of electrum.
i think it is worth to open a new issue on GitHub reporting this so that the developers can look into it. sometimes being more familiar with the code helps understanding why these things happen, my familiarity with Electrum code is small mainly due to it being written in python.


Title: Re: 4.0.2 => edit fee => change address
Post by: HCP on July 17, 2020, 01:17:06 AM
...
your wallet sees a transaction from your wallet (addresses) to a new address that it does not recognize (it is not part of its address list). so the assumption is that you are making a payment for instance (like paying 50000 satoshi to buy a cup of coffee). when you decrease the fee, the wallet doesn't change the payment amount because if it did change it to 50500 then it will increase the coffee's cost. instead it creates a new address and sends the leftover there. hence the new 1321 sat green address in the final picture.

it doesn't matter if you clicked "Max" button, your wallet doesn't remember this (as far as i can tell from the code) and it shouldn't matter to it either. all it sees and remembers is this transaction with its inputs/outputs.
Only, that isn't how it appears to work... As tested by myself (and nc50lc), once I've clicked "Max" (or used "!"), it will max out the amount going to the single output... if I change the fee, it modifies the output amount appropriately so it is still sending "everything - fee"... there is no extra output generated.

Is your wallet creating the extra output when "max" is used? ??? In which case, there seems to be some sort of inconsistency in how things are working... ???