Update coin selection terminology#146
Conversation
|
Strong opinions, weakly held. ;) |
|
Ahahaha, as I said on Discord I don't have any particular preference between the two, but I also don't think my opinion should matter too much in this context because I'm generally terrible at naming things.. I wanted to get some feedback from native english speakers just to see what they think about this, then we'll decide what to do :) |
|
I prefer this new terminology, it's shorter and clearer. It will impact @danielabrozzoni for PR #148, and @LLFourn originally introduced the current names. If they have no objections I think we should accept this PR. |
|
Cool for me, ACK :) |
There was a problem hiding this comment.
ACK. One comment needs to be fixed up.
Fort those interested in the way I think about naming:
In general I try and tune the level of abstraction in the names of things to my level of confidence about them. For example get_must_may_use_utxo is a very concrete name which indicates I don't have much confidence in it. This is a hint to the next person that they shouldn't be afraid to totally remove it if they think of a better way of arranging things.
preselect_utxos on the other hand is a more abstract and therefore more confident name. The hint for the reader is that the author thought that "utxo preselection" is a necessary step when solving the problem.
I don't have an issue with preselect_utxos since perhaps by having a single function that takes all the builder arguments and returns the two utxo lists I am really closely modelling the abstract problem of figuring out which inputs a transaction can use.
WRT to may/must vs optional/required I don't have much of a preference.
| // We put the "must_use" UTXOs first and make sure the "may_use" are sorted, initially | ||
| // smallest to largest, before being reversed with `.rev()`. | ||
| let utxos = { | ||
| may_use_utxos.sort_unstable_by_key(|(utxo, _)| utxo.txout.value); |
There was a problem hiding this comment.
change the comment above as well.
There was a problem hiding this comment.
I've updated the comment and amended the change into the optional_utxos commit.
|
Thanks, your comment on naming is great food for thought. |
fc303cf to
457e70e
Compare
|
As @xekyo was saying in #148, there are some other variables that might benefit from a name change :) (
I actuall like both proposals, but I would feel better if we changed them in the whole coin selection code and not only in the bnb implementation :) Do you think you can add those changes in this MR too? Thoughts? @LLFourn @notmandatory |
|
As a coin selection novice I like the current names Could there be any other amount needed by coin selection other than to pay for the sum of the receiver's outputs? For fee amount it's a little less clear, it's really the current accumulated fee amount, but fee amount for short still makes sense. Could future algorithms need to keep track of some other fee amount? That all said, these are my weakly held opinions. :-) |
I think
I agree that fee_amount is not great since it is really "what we've computed as the fee so far, please add to this and return it". I don't have a strong opinion about what to replace it with. |
My point was that That said, I wouldn't want to suggest that it's a priority or a big win to change either. |
|
I guess I'll just merge this one now since more or less everybody seems to agree that the current terminology is at least not terrible. If you have more ideas for other things that would benefit from a renaming, feel free to open more issues/PRs! |
This renames the following:
"must_use" and "may_use" are visually similar and this change improves the readability as well as better describing the two separate sets.