Refactor CWallet::AvailableCoins method signature#1859
Conversation
random-zebra
left a comment
There was a problem hiding this comment.
This does not compile.
The signature of CreateTransaction needs to be updated in WalletModel::prepareTransaction too.
|
yeah, doing it. I forgot that my environment had qt disabled. |
d8c9e92 to
c712a46
Compare
|
updated. |
random-zebra
left a comment
There was a problem hiding this comment.
Aside from a couple bugs, I am not sure about the concept.
It seems to make the code more complex, because these flags don't really belong to the coinControl object.
Most of the times these are used when CC is null.
And when coinControl is not null, and we have coins selected, then we don't care about specific flags because we simply want to skip everything except the selection, at this line:
if (fCoinsSelected && !coinControl->fAllowOtherInputs && !coinControl->IsSelected(COutPoint((*it).first, i)))
continue;
Essentially made this to be able to add more features and don't continue extending the method signature. It has so many arguments with default values that it's easy to call this method wrongly without noticing it. The two options to solve this: (1) use the CoinControl wrapper, (2) create a new struct for the extra arguments that we are passing one by one to I'm more inclined to the first one because the CoinControl was essentially built for that reason. Add certain coins filtering capabilities in a single object and not pass them as arguments (making the |
Well, the purpose of CCoinControl is to provide an interface to manage a set of outpoints ( Anyway the added complexity of (1) is kinda highlighted by these sneaky bugs on something that was supposed to be "purely an aesthetic improvement, no functional changes". So, yeah, I would definitely prefer (2) over (1). |
Indeed, good idea. That will make a nice speed difference in the tx creation process for users with lot of txs that manually selected the utxo to spend. #- Going with (2) for now then. It's more organized and readable. |
|
Closing this one, made a complete overhaul of the area in #1977 |
Purely an aesthetic improvement, no functional changes. Combining parameters that should had been coded into
CoinControlwrapper class in the first place.