-
Notifications
You must be signed in to change notification settings - Fork 38.8k
[rpc] [wallet] Allow specifying the output index when using bumpfee #12096
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
|
Missing test. |
|
This decreases the output? In some cases that may desirable, but in general I think that's very unexpected (I would think it would add a new input instead). |
|
If you don't have a change address chance are fairly high that you're simply moving coins (e.g. between wallets). Especially if you only have one utxo in, you may not want to associate other utxo's with it for privacy reasons. |
I would argue that this is not stated strongly enough. If they previously paid to a single output then it is almost always true that they do not care about the particular amount. This is especially true as the previous amount was subject to an arbitrary, variable fee. Valid use cases where this behavior is necessary, where you really don't want to require adding more inputs in order to bumpfee:
I would further suggest if the receiver was expecting a particular amount then you would expect there to be a change output. |
|
@kallewoof You're right that in most cases right now that you don't care about the amount if there is only one output, but there is certainly no guarantee. The coin selection algorithm even explicitly tries to find a solution without change first - it's just pretty terrible at its job current (#10637 will make it succeed much more often). |
|
I think this could be generalized and also be made safer by adding an |
|
I don't think it makes sense to arbitrarily add inputs to bumpfee. I don't even know if RBF allows it (since you're suggesting it, I guess it does -- I thought I tried and failed). Maybe a Edit: @ryanofsky That looks good to me. |
|
I don't see why RBF wouldn't allow it, as long as all transactions you're replacing have been marked as replaceable. I like the idea of explicitly marking an output that can be reduced. Over time (especially after #10637), I think we'll inevitably need a way to bump transactions that don't have change. Depending on feerates and your wallet's UTXO set distribution, a large fraction of transactions may be created without change. |
|
does the wallet track which outputs had subtractFeeFromOutput? In that case further reduction seems completely fine as well. |
test/functional/bumpfee.py
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.
Check new output is less than 0.00099?
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.
Thanks, good point - fixing.
|
Agree that there are cases where the output(s) can't be reduced. In the cases it can be reduced, should it be re-funded? |
@kallewoof Currently our relay policy (and BIP 125) require that if you add a new input, it must be already confirmed -- perhaps you tested with an unconfirmed input? (The idea behind that requirement was to ensure the new transaction was more likely to be mined than the ones it was replacing; now that we use ancestor feerate mining, we could perhaps relax this requirement and compare ancestor feerates of everything instead to ensure the new transaction has a higher mining score.) |
|
concept ack after the current coin selection stop trying 1 output (I assume #10637 solves that?). |
|
NAK. The only time it would be acceptable to reduce the output is if the transaction was created as subtract fee from output. Bumping should add additional inputs as required. |
|
@gmaxwell even with an option to allow the subtract, default to false (since there is no subtract from output record)? |
|
if it were behind a bunch of warnings, ... but even though if substract from wasn't initially selected should only be a last resort if it can't bump otherwise. The wallet shouldn't quietly direct the user into behavior that might cause them to get criminally prosecuted. |
|
@wtogami The wallet has explicit information about transactions created where the user requested subtracting fees from amounts. Using that information would be fine but you cannot use the lack of a change output to detect this, when 2^inputs * fees_saved_from_excluding_an_output is large relative to the amount being paid an exact match frequently exists. And the PR pieter linked to will usually find it. |
|
Summary:
For this PR, that translates to:
|
d75d90b to
861d605
Compare
|
src/wallet/feebumper.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.
This error will also display in the gui. Not sure if it makes sense there to mention reduce_output
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.
Oh. Hm..
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.
It also sounds confusing when there isn't a single output?
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.
I'll just revert it.
src/wallet/rpcwallet.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.
This will segfault on OOB
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.
Oops. Added bounds check in feebumper::CreateTransaction.
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.
Where?
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.
Also add assert_raises_rpc_error tests for:
- when not a number;
- when reduce_output < 0 and >= len(vout).
For instance, see 7f67dd0.
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.
No idea how that happened, but my changes are gone. Fixing, again.
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.
Needs a lower bounds check here too, to avoid accepting -1.
8b3fa19 to
02d1508
Compare
fa2db1b to
5b37cc1
Compare
5b37cc1 to
d5a711e
Compare
d5a711e to
61a0412
Compare
61a0412 to
52442ef
Compare
52442ef to
7c4555e
Compare
7c4555e to
e82c8ff
Compare
src/wallet/feebumper.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.
Nit: Extra space on the end
src/wallet/feebumper.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.
CreateTotalBumpTransaction returns an error if reduce_output is out of range. This code just ignores it. Probably should be consistent.
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.
"change" is really over-loaded here, please call it something else
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.
@luke-jr Agreed - now consistent.
@instagibbs Renamed to reduce_output_vout.
src/wallet/feebumper.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.
Couldn't this result in the reduce_output getting increased? That could be a serious problem in some cases...
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.
I'm not sure I follow. In which case would reduce_output increase?
Currently, bumpfee cannot be used to bump a single output transaction. This should be possible, as single output transactions are special in that the exact amount doesn't usually matter (the user is emptying a wallet or using coin control to move UTXOs).
e82c8ff to
086313c
Compare
| Needs rebase |
|
Rebase is becoming overwhelming on this. Closing until further notice (may rewrite the code). |
No description provided.