-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Wallet: Minimum output value depends on fee instead of minTxRelayFee #8356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/wallet/wallet.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 6?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As explained, the problem with relay fee (txMinRelayFee right ?) is that when we bump it as we did on #6793, then old wallet starts to send unrelayable transaction which cause perturbations to users.
6 is arbitrary, the goal is to not create output which would cost more than their value to redeem in 6 block.
I'm open to any other number, I just wanted it to be a bit higher than txMinRelayFee so we have space to increase this default later without impacting users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NicolasDorier Please note that 6793 has been reverted in the meantime while adding the size limit to the mempool. What @sipa meant, is to use the minimum relay fee of your current mempool and not the minimum relay fee of the node (hardcoded) nor the expected transaction fee to confirm within 6 blocks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohh I did not know that the mempool also had its own minimum relay fee.
|
I could imagine this will confuse users "Why can't I send this transaction? It has the same sized outputs as the transaction I send just 2 hours earlier..." But thanks for working on this. @xekyo is working on improving the coin selection so make sure to discuss any conflicts with his work. |
|
@MarcoFalke oh that's cool, the coin selection code is very convoluted, I'm happy someone working on it.
The code impact only the wallet, not the relay policy. Thus, for such thing to happen, you would need a sudden big fee variation AND not having enough satoshi for paying the small surplus. So this should be rather rare. The bump of minTxRelayFee however, had long lasting impact until people upgraded their wallet (breadwallet was impacted, I reported the issue there long time ago, they also now use estimated fee for the min size of outputs) |
|
I agree with @NicolasDorier that we need to do something to prevent what happened last time we raised the min relay fee. I would suggest at least two things.
|
You mean changing the relay policy ? I think it should be eventually done, but in a separate PR.
@morcos the last bump was x5, which is why I think using estimateFee is a better idea. I am fine for estimateFee(25). What about taking the max between estimateFee(25) and 4x txMinRelayFee ? |
|
Ah and just remembered bitcoin/src/qt/coincontroldialog.cpp Line 454 in d612837
|
2467bd4 to
c5ec9ce
Compare
|
Updated:
|
|
@NicolasDorier What I meant by separating the min relay fee from isDust, is that I think the next time we adjust minRelayFee or if anyone adjusts it locally, it should not automatically change isDust. They should be separate limits. So if we do bump minRelayFee by 5x, isDust doesn't actually change at all, unless we intentionally change it. And we can intentionally make sure it stays below whatever the min output value we have used in the past couple releases is. Using minimum mempool fee or fee estimation is a mistake. Both those things are completely volatile on a newly started node. And even estimatefee(25) can shoot up high temporarily under network load, but shouldn't cause you to adjust minimum output values unless its a more permanent shift. I think longer term more stable fee estimates will eventually be possible, but we don't have them now. |
|
@morcos I disagree here. Even without any IsDust rule implemented on the network, wallets should (purely for their own sake) avoid creating change outputs whose value is so low that it is anywhere near close to uneconomical to spend. Sure, we don't have an accurate long-term prediction of fee rates on the network, but our best guess is close enough - even if it easily fluctuates by some constant factor. |
|
@morcos I agree that minRelayFee should be completely separate from IsDust definition to prevent this problem. However, the best we have now is estimatefee and the mempool.minRelayFee. Knowing whether an output is economical depends on 1. knowing when it will be spent, 2. how much the fees will be at this time. Both are unknown and can't be predicted in any way. What I want to do in this PR though is mainly to prevent future ::minRelayFee default change of impacting too much relaying. Two nice side effect is smaller UTXO and wallets likely wasting less money. I don't know how volatile is estimatefee if there is a smoother metric I'm all open. Would have liked to talk about that in dev's meeting, sadly it starts at 4am for my place :( |
|
@NicolasDorier Sure or we could talk at a different time. |
|
I am closing it for now. It seems that coin selection prevent change below 0.01 BTC. |
When #6793 (bump of txMinRelayFee) was released, lots of transactions made by older wallet stopped being relayed (output occasionally below dust), causing trouble to users who suddenly thought that their transactions were not confirmed because of the 1MB limit.
This PR make sure that the wallet minimum value output is a function of fee instead of a function of txMinRelayFee, so any bump in the future would not have bad consequences.
It will also save some UTXO space by preventing the creation of output which would likely be uneconomical to redeem.