Skip to content
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

refactor: remove redundant fOnlySafe argument #21910

Merged
merged 1 commit into from May 13, 2021

Conversation

t-bast
Copy link
Contributor

@t-bast t-bast commented May 11, 2021

The fOnlySafe argument to AvailableCoins is now redundant, since #21359 added a similar field inside the CCoinControl struct (see #21359 (comment)).

Not all code paths create a CCoinControl instance, but when it's missing we can default to using only safe inputs which is backwards-compatible.

The fOnlySafe argument to AvailableCoins is now redundant, since bitcoin#21359
added a similar field inside the CCoinControl struct.

Not all code paths set a CCoinControl instance, but when it's missing we
can default to using only safe inputs which is backwards-compatible.
Copy link
Member

@instagibbs instagibbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK c30dd02

Copy link
Member

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK c30dd02.

@@ -2197,7 +2197,7 @@ CAmount CWallet::GetAvailableBalance(const CCoinControl* coinControl) const

CAmount balance = 0;
std::vector<COutput> vCoins;
AvailableCoins(vCoins, true, coinControl);
AvailableCoins(vCoins, coinControl);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an actual refactor because this changes behavior. But in practice AMT there's no call to GetAvailableBalance with m_include_unsafe_inputs = true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, it does change behavior here but is backwards-compatible so I think it should be ok.
If later we want to make GetAvailableBalance with m_include_unsafe_inputs = true possible, we can use coinControl for that.

Copy link
Member

@achow101 achow101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK c30dd02

Copy link
Contributor

@meshcollider meshcollider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review + test run ACK c30dd02

@meshcollider meshcollider merged commit 386ba92 into bitcoin:master May 13, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 13, 2021
@t-bast t-bast deleted the refactor-fonlysafe branch May 13, 2021 18:12
gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants