Skip to content

Conversation

achow101
Copy link
Member

@achow101 achow101 commented May 16, 2025

The remaining isminetypes are ISMINE_SPENDABLE and ISMINE_USED.

ISMINE_USED is only used as a filter for caching balances and is never actually returned from IsMine. Since we do still want this behavior, This PR changes the caching to utilize bools and explicit members variables to account for the avoid_reuse case. This allows us to remove ISMINE_USED.

ISMINE_SPENDABLE and ISMINE_NO are the only things that are returned by IsMine. This is a bool, so it can be replaced as such.

After removing ISMINE_USED and ISMINE_SPENDABLE, we are able to remove isminetypes altogether.

@DrahtBot
Copy link
Contributor

DrahtBot commented May 16, 2025

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32523.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK murchandamus, enirox001, jlest01, fjahr, davidgumberg
Stale ACK w0xlt, rkrux

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #33218 (refactor: rename fees.{h, cpp} to fees/block_policy_estimator{h, cpp} by ismaelsadeeq)
  • #31664 (Fees: add Fee rate Forecaster Manager by ismaelsadeeq)
  • #30157 (Fee Estimation via Fee rate Forecasters by ismaelsadeeq)
  • #27865 (wallet: Track no-longer-spendable TXOs separately by achow101)
  • #10102 (Multiprocess bitcoin by ryanofsky)

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.

@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed.
Task MSan, depends: https://github.com/bitcoin/bitcoin/runs/42330203892
LLM reason (✨ experimental): The CI failure is due to a thread safety error in spend.cpp.

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

@fanquake
Copy link
Member

 /home/runner/work/_temp/src/wallet/spend.cpp:474:12: error: calling function 'AvailableCoins' requires holding mutex 'wallet.cs_wallet' exclusively [-Werror,-Wthread-safety-analysis]
  474 |     return AvailableCoins(wallet, coinControl, /*feerate=*/ std::nullopt, params);
      |            ^
1 error generated.

@achow101
Copy link
Member Author

Rebased, ready for review.

@achow101 achow101 marked this pull request as ready for review May 21, 2025 17:51
@rkrux
Copy link
Contributor

rkrux commented May 21, 2025

This PR comes at a right time. I'm prioritising reviewing this one because it removes isminetype.

#27286: The new wallet unspents model in memory is using isminetype currently and I'd prefer to not have it checked into master only to be removed subsequently. This PR changes should also ease the review of the other PR.

d637af8#diff-d41d68c5a65d67956c91b33ca86da7df1981d84a0b15b4a186deea566563fed5R372

@achow101 achow101 force-pushed the delete-isminetypes branch from d9ca23f to 8fba2fa Compare August 14, 2025 22:39
@achow101
Copy link
Member Author

I also found a few left-over mentions of isminetype(s) in comments: fjahr@12a1b67 (could be fixed in a follow-up though if I am mistaken in my comment).

I'm choosing to leave those comments in since they are specifically related to legacy wallet behavior

@fjahr
Copy link
Contributor

fjahr commented Aug 14, 2025

utACK 8fba2fa

@DrahtBot DrahtBot requested review from w0xlt and rkrux August 14, 2025 22:48
Copy link
Contributor

@rkrux rkrux left a comment

Choose a reason for hiding this comment

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

re-ACK 8fba2fa

git range-diff d9ca23f...8fba2fa

The CI error seems unrelated to me.

The is_mine output parameter is never used by any callers.
@achow101 achow101 force-pushed the delete-isminetypes branch from 8fba2fa to 65f1089 Compare August 19, 2025 17:30
Copy link
Contributor

@enirox001 enirox001 left a comment

Choose a reason for hiding this comment

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

ACK 620abe9 — built & tested locally; wallet tests passed. Behavior-preserving refactor; removing isminetype in favor of explicit booleans improves clarity.

Non-blocking nit: wallet_migration.py still references ISMINE_SPENDABLE / ISMINE_NO in comments. Functionally the tests use the boolean ismine; could you briefly explain why you kept the enum names in the comments, or consider changing them to ismine == True / ismine == False for consistency?

@achow101
Copy link
Member Author

Non-blocking nit: wallet_migration.py still references ISMINE_SPENDABLE / ISMINE_NO in comments. Functionally the tests use the boolean ismine; could you briefly explain why you kept the enum names in the comments, or consider changing them to ismine == True / ismine == False for consistency?

#32523 (comment)

@fjahr
Copy link
Contributor

fjahr commented Aug 19, 2025

re-ACK 620abe9

Copy link
Contributor

@murchandamus murchandamus left a comment

Choose a reason for hiding this comment

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

Concept ACK

In descriptor wallets, we consider all outputs to be spendable as we no
longer have mixed mine and watchonly in a wallet. As such,
COutput::spendable is meaningless and can be removed.

Furthermore, CoinFilterParams::only_spendable can be removed as that was
essentially checking for COutput::spendable.

Lastly, AvailableCoinsListUnspent can also be removed as the wrapper is
now only setting the feerate to std::nullopt which is trivial enough that
a dedicated wrapper is not needed.
This isminetype is not a real isminetype as it is never returned by
IsMine. This is only used for isminefilters in one function, which can
be better represented with a bool parameter avoid_reuse.
Since the only remaining isminetypes are ISMINE_NO and ISMINE_SPENDABLE,
this enum is now just a bool and can be removed. IsMine is changed to
return a bool and any usage of isminetypes and isminefilters are changed
to be the remaining ISMINE_SPENDABLE case.
@achow101 achow101 force-pushed the delete-isminetypes branch from 65f1089 to be776a1 Compare August 19, 2025 21:52
@murchandamus
Copy link
Contributor

ACK be776a1

Copy link
Contributor

@enirox001 enirox001 left a comment

Choose a reason for hiding this comment

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

re-ACK be776a1

Copy link

@jlest01 jlest01 left a comment

Choose a reason for hiding this comment

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

reACK be776a1

@fjahr
Copy link
Contributor

fjahr commented Aug 20, 2025

reACK be776a1

@davidgumberg
Copy link
Contributor

crACK be776a1

@fanquake fanquake merged commit 8333aa5 into bitcoin:master Aug 21, 2025
19 checks passed
domob1812 added a commit to domob1812/namecoin-core that referenced this pull request Aug 29, 2025
Updated Namecoin-specific wallet code for the upstream removal of
isminetype (bitcoin/bitcoin#32523).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.