-
Notifications
You must be signed in to change notification settings - Fork 37.4k
wallet: unify “allow/block other inputs“ concept #25118
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
wallet: unify “allow/block other inputs“ concept #25118
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Actually I don't think they are different behavior. They just are set and checked at different times so these two variables appear to be controlling different things. If There is some weird interactions between then, such as when So there is no need to introduce |
Hey achow101, thanks for the review!
I came to the same conclusion but.. the reason behind the new flag are all the In other words, the usage of An easy example of this is the locked coins skip that is inside The locked coins are, forcibly, selected inside the second part of To try it, you can just set the new flag So.. conclusion: I agree with you and have been working on it on a local branch. Unifying and cleaning most of these redundancies (thus why found #25005). And added the manual flag here in order to not add a bulk of changes that are required to keep the same current behavior (explained above) without entering into the rabbit hole. Getting deeper, some of the rabbit hole changes, linked to this work, that I have been working on locally (WIP) are:
|
I don't think this is a useful distinction. The only ways to manually set inputs are through |
9e84363
to
0561612
Compare
I think that, with different words, we are saying the same thing and heading into the same direction. Let’s try to split the GUI from the RPC flow. There is a small misunderstanding there; the distinction that made was merely to describe how the current process is working: You can provide locked and already spent inputs to This was happening because of the entangled So, essentially, in the current flow in master, if you provide inputs to Now, based on that, the point that tried to make in my previous comment is that in order to unify both values into Update Summary:Pushed the Otherwise the command will not support the selection of locked and spent coins (note: whether we accept or not the selection of spent coins on Now.. if we are sync up to this point we can move onto the final topic, there is still one more behavior change that I need to cover and test after the I was leaving that work for a follow-up PR (have a branch locally that removes/refactor all the output search functionality out from |
Okay, I think we're on the same page now. I think it's actually sufficient to drop the iteration of vCoins in the |
…block below the selected outputs lookup. Otherwise, RPC commands such as `walletcreatefundedpsbt` will not support the manual selection of locked, spent and externally added coins. Full explanation is inside bitcoin#25118 comments but brief summary is: `vCoins` at `SelectCoins` time could not be containing the user manually selected input because, even when they were selected by the user, the current `AvailableCoins` flow is skipping locked and spent coins. Extra note: this is an intermediate step to unify the `fAllowOtherInputs`/`m_add_inputs` concepts. It will not be a problem anymore in the future when we finally decouple the wtx-outputs lookup process from `SelectCoins` and don't skip the user's manually selected coins in `AvailableCoins`.
0561612
to
4be0887
Compare
Yeah achow101 that is an option as well 👍🏼. I briefly thought on it at the beginning but.. as the end goal is decouple/remove the whole lookup responsibility from But yeah.. I agree with you. Let's go with that option in this PR so it's properly scoped to unify the Changes pushed. |
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 4be0887
re-ACK 9bb6f04 |
hey @Sjors (sorry for the ping, didn't find you on IRC), you might be interested on this. |
i get a build error with this merged to master:
|
…ected inputs lookup Otherwise, RPC commands such as `walletcreatefundedpsbt` will not support the manual selection of locked, spent and externally added coins. Full explanation is inside bitcoin#25118 comments but brief summary is: `vCoins` at `SelectCoins` time could not be containing the manually selected input because, even when they were selected by the user, the current `AvailableCoins` flow skips locked and spent coins. Extra note: this is an intermediate step to unify the `fAllowOtherInputs`/`m_add_inputs` concepts. It will not be a problem anymore in the future when we finally decouple the wtx-outputs lookup process from `SelectCoins` and don't skip the user's manually selected coins in `AvailableCoins`.
1dd1016
to
68dab89
Compare
great, thanks @laanwj 👌🏼. Rebased on master, silent issue fixed. |
Seeking to make the `CoinControl` option less confusing/redundant. In bitcoin#16377 the `CoinControl` flag ‘m_add_inputs’ was added to tell the coin filtering and selection process two things: - Coin Filtering: Only use the provided inputs. Skip the Rest. - Coin Selection: Search the wtxs-outputs and append all the `CoinControl` selected outpoints to the selection result (skipping all the available output checks). Nothing else. Meanwhile, in `CoinControl` we already have a flag ‘fAllowOtherInputs’ which is already saying: - Coin Filtering: Only use the provided inputs. Skip the Rest. - Coin Selection: If false, no selection process -> append all the `CoinControl` selected outpoints to the selection result (while they passed all the `AvailableCoins` checks and are available in the 'vCoins' vector). As can notice, the first point in the coin filtering process is duplicated in the two option flags. And the second one, is slightly different merely because it takes into account whether the coin is on the `AvailableCoins` vector or not. So it makes sense to merge ‘m_add_inputs’ and ‘fAllowOtherInputs’ into a single field for the coin filtering process while introduce other changes to add the missing/skipped coins into 'vCoins' vector if they were manually selected by the user (follow-up commits).
…ected inputs lookup Otherwise, RPC commands such as `walletcreatefundedpsbt` will not support the manual selection of locked, spent and externally added coins. Full explanation is inside bitcoin#25118 comments but brief summary is: `vCoins` at `SelectCoins` time could not be containing the manually selected input because, even when they were selected by the user, the current `AvailableCoins` flow skips locked and spent coins. Extra note: this is an intermediate step to unify the `fAllowOtherInputs`/`m_add_inputs` concepts. It will not be a problem anymore in the future when we finally decouple the wtx-outputs lookup process from `SelectCoins` and don't skip the user's manually selected coins in `AvailableCoins`.
68dab89
to
d5c5edb
Compare
…lookup Otherwise, RPC commands such as `walletcreatefundedpsbt` will not support the manual selection of locked, spent and externally added coins. Full explanation is inside bitcoin#25118 comments but brief summary is: `vCoins` at `SelectCoins` time could not be containing the manually selected input because, even when they were selected by the user, the current `AvailableCoins` flow skips locked and spent coins. Extra note: this is an intermediate step to unify the `fAllowOtherInputs`/`m_add_inputs` concepts. It will not be a problem anymore in the future when we finally decouple the wtx-outputs lookup process from `SelectCoins` and don't skip the user's manually selected coins in `AvailableCoins`.
-BEGIN VERIFY SCRIPT- sed -i 's/fAllowOtherInputs/m_allow_other_inputs/g' -- $(git grep --files-with-matches 'fAllowOtherInputs') -END VERIFY SCRIPT-
d5c5edb
to
d338712
Compare
rebased, conflicts solved. Ready to go. |
Code review ACK d338712 |
Noticing some new irrational behavior in a forked coin control and this is the most significant work on coin control pulled from upstream. @furszy any change you could glance over the screenshots and assess the probability of this being an upstream issue? |
Sorry, this is not a support forum for forks of this project. |
@beirut-boop not because of this PR, but check #26699. |
What fanquake pointed out, which I agree, is about linking other repositories issues here. It isn't the best because we don't know what you have there (nor people are going to get deeper trying to find it). Time is a scarce resource for everyone. But happy to help if you create an issue running bitcoin-core and describing your problematic next time. Also, happy to get more eyes on #26699. Feel welcome to write your feedback there. |
@furszy I understand, concur, and have removed the link from my comment.
I agree. That's why I thought a quick assessment on the observed issue with the coin control classes before spending time setting up a Bitcoin testnet wallet with the intention of taking up more of your time to look into it was a good approach. I'm not affiliated with either project, but rely on both. The project is different but the coin control classes are identical, so I assumed I was helping everyone. Apologies. I will not cross contaminate the comment section again in the future. 👍 |
Seeking to make the
CoinControl
options less confusing/redundant.It should have no functional changes.
The too long to read technical description; remove
m_add_inputs
, we can use the already existentfAllowOtherInputs
flag.In #16377 the
CoinControl
flag ‘m_add_inputs’ was added to tell the coin filtering and selection process two things:CoinControl
internal and external selected outpoints to the selection result (skipping all the available output checks). Nothing else.Meanwhile, in
CoinControl
we already have a flag ‘fAllowOtherInputs’ which is already saying:CoinControl
selected outpoints to the selection result (while they passed all theAvailableCoins
checks and are available in the 'vCoins' vector).Changes
As can notice, the first point in the coin filtering process is duplicated in the two option flags. And the second one, is slightly different merely because it takes into account whether the coin is on the
AvailableCoins
vector or not.So it makes sense to merge ‘m_add_inputs’ and ‘fAllowOtherInputs’ into a single field for the coin filtering process while introduce other changes to add the missing/skipped internal and external coins into 'vCoins' vector if they were manually selected by the user.
——————————————————————————————————
Just as an extra note:
On top of this, I’m working on unifying/untangling further the coin filtering and selection processes so we have less duplicate functionality in both processes.