-
Notifications
You must be signed in to change notification settings - Fork 7
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
No more base weight #21
Conversation
- CoinSelector no longer tracks anything but input weight - Previously the value of the target outputs was in `Target` but the weights were accounted for in CoinSelector. Now they're in all in target. - This allows us to actually figure out how many outputs there are and therefore the actual weight of the transaction accounting for varints.
5482f81
to
7e82c3f
Compare
changeless should not be that slow but if it fails to find a changeless solution then the test will exhaustive search so that clearly will take forever.
Yeah, the waste metric is only used as a tiebreaker rather than something to optimize for because it would happily consolidate all your UTXOs at low feerates. What did you end up using instead? Sorry, I only discovered this codebase recently per the Optech Newsletter, I’ll take a bit of a look around. :) |
Hey @murchandamus! We've been keeping this code base low profile because it's still in science experiment stage. FWIW we gathered a long time ago that the waste metric was not something that you should use to actually optimize for -- it was just a good one to use to start the experiment. I'm interested in your work here: https://delvingbitcoin.org/t/gutterguard-and-coingrinder-simulation-results/279. It would be cool to try and replicate it. We're just using what we call |
Ah that sounds similar to what I’m trying to do with CoinGrinder, where I am trying to always find the input set with the lowest input weight. The PR should hopefully be very readable: I organized the pullrequest to start with a simple implementation of the algorithm and then each improvement or optimization a separate commit. I still have a little hope that it might make the release, even if I did miss the really big feerates. In combination with BnB, and the waste metric, I guess I’d get something similar as the outcome of your |
We already have const `Drain::NONE` which should be used instead.
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.
ACK ab38cb0
I saw some obvious mistakes so I pushed fixes as commits. Everything else looks good to me. The LowestFee
bound function looks correct.
The logic was wrong before because it was making the RBF constraints take precedence. Instead, we should be taking the maximum between the fee calculated from the target feerate and the minimum fee that satisfies the RBF constraints.
ab38cb0
to
c650306
Compare
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.
ACK c650306
Fixes #1
On top of #19
Target
but theweights were accounted for in CoinSelector. Now they're in all in
target.
therefore the actual weight of the transaction accounting for the varint for the number of outputs.
This wasn't what the issue had in mind but it was easier to take the
base_weight
out ofCoinSelector
and put it inTarget
rather than putTarget
inCoinSelector
. Getting rid ofbase_weight
is a more crucial change than expected because rust bitcoin changed whatTransaction::weight
returns for empty output transactions recently so using it to determinebase_weight
will get different answers between versions (this breaks our weight tests but this PR will fix it I think if we uprade dev deps). We only need to know the total weight of the outputs and how many there are now to get the right answers for weight.