-
Notifications
You must be signed in to change notification settings - Fork 8
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
Make Changeless
metric more useful when combined.
#17
Comments
We have some situations where we only want solutions with change so I'm interested in the approach taken here and seeing how best to adapt it to our case. |
Can you explain more fully what you had in mind. And filter for what? Tightness of bounds refers to how accurate the bounding function of a metric is. When you combine two metrics the bounding function necessarily becomes less accurate in the sense that the ordering on candidate solutions for the combined will be worse than each individual metric. Maybe your question is whether it's right to do But FWIW I agree that the changeless metric is not very useful. It's always a mistake to add it atm so it probably shouldn't exist.
Interesting. So for this I'd say that the output's weight should just be added to the base transaction weight with the minimum value you'd accept for the change included in the Note one might think a policy of "always add change" might be the way to go here but this will add change even when the excess value is below the relay limit for that output. You'd need a way of expressing "always add change with at least this value" and I think this will complicate things. Out of interest why do you need this. I've actually seen another case in the ecosystem where they always add change but I thought it was a peculiar scenario. @evanlinjin I'd wonder what you think as well. |
Yep, that makes sense thanks. The approach we've taken for now is to create a new metric based on
We use this for sweep-type transactions. For example, if we want to refresh the timelock on some UTXOs, we create a new transaction with these UTXOs as inputs and no outputs, and then get as much change as possible given the target feerate. The "must have change" condition ensures we return a selection with change rather than one with a lower score that would create a transaction with no outputs. Another case is when we want to "cancel" a transaction using RBF, we create a replacement transaction that sends as much as possible to change at the target feerate and removes the outputs. |
Yeah sounds suboptimal but that will work :)
In this case you won't use branch and bound because the set of coins you're going to spend is fixed right? You just select everything that needs to be updated, add a zero value output with the weight of your draining output, figure out the excess for the feerate and finally set the value of the draining output to the excess.
Why does it have to have a change output if you're just doing RBF? |
That's right sorry, the coin selection is already done in this case and it's just a question of seeing if there's enough excess for change. For the RBF "cancel" transaction, we only need to select at least one of the inputs from the transaction to be replaced and so we do use coin selection in that case.
This is for one particular use of RBF where we "cancel" the transaction by replacing it with another that has only a change output. This way, we keep all our funds from the first transaction except for the fee of the replacement transaction. |
@LLFourn mentioned in a private discussion:
I responded with:
Relevant Context
The text was updated successfully, but these errors were encountered: