wallet, follow-up: Refactor IsSpent to use HowSpent #35151

Open
musaHaruna wants to merge 1 commit from wallet-use-howspent-for-isspent into master AGit
musaHaruna commented 2026-04-24 12:53:10 +00:00 (Migrated from github.com)

Follow-up to #33671

This PR refactors CWallet::IsSpent to reuse the logic already implemented in CWallet::HowSpent.

Instead of manually iterating over mapTxSpends and checking transaction states, IsSpent now simply returns:

return HowSpent(outpoint) != SpendType::UNSPENT;

Also move CWallet::IsSpent from wallet.cpp to wallet.h as a small inline helper, since it is a one-line wrapper around HowSpent.

Follow-up to [#33671](https://github.com/bitcoin/bitcoin/pull/33671#discussion_r2920222467) This PR refactors `CWallet::IsSpent` to reuse the logic already implemented in `CWallet::HowSpent`. Instead of manually iterating over mapTxSpends and checking transaction states, IsSpent now simply returns: `return HowSpent(outpoint) != SpendType::UNSPENT;` Also move `CWallet::IsSpent` from wallet.cpp to wallet.h as a small inline helper, since it is a one-line wrapper around HowSpent.
DrahtBot commented 2026-04-24 12:53:24 +00:00 (Migrated from github.com)

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

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK polespinasa
Concept NACK luke-jr
Concept ACK pablomartin4btc

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #27865 (wallet: Track no-longer-spendable TXOs separately by achow101)

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.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/35151 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/35151.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/35151#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [polespinasa](https://github.com/bitcoin/bitcoin/pull/35151#pullrequestreview-4904988743) | | Concept NACK | [luke-jr](https://github.com/bitcoin/bitcoin/pull/35151#issuecomment-4320329483) | | Concept ACK | [pablomartin4btc](https://github.com/bitcoin/bitcoin/pull/35151#pullrequestreview-6163772642) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts Reviewers, this pull request conflicts with the following ones: * [#27865](https://github.com/bitcoin/bitcoin/pull/27865) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/27865.svg"></sub> (wallet: Track no-longer-spendable TXOs separately by achow101) 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. <!--5faf32d7da4f0f540f40219e4f7537a3-->
DrahtBot commented 2026-04-24 13:02:28 +00:00 (Migrated from github.com)

🚧 At least one of the CI tasks failed.
Task lint: https://github.com/bitcoin/bitcoin/actions/runs/24890514354/job/72881342200
LLM reason (✨ experimental): CI failed the trailing_whitespace lint check due to trailing whitespace in src/wallet/wallet.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.

<!--85328a0da195eb286784d51f73fa0af9--> 🚧 At least one of the CI tasks failed. <sub>Task `lint`: https://github.com/bitcoin/bitcoin/actions/runs/24890514354/job/72881342200</sub> <sub>LLM reason (✨ experimental): CI failed the `trailing_whitespace` lint check due to trailing whitespace in `src/wallet/wallet.cpp`.</sub> <details><summary>Hints</summary> 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. </details>
polespinasa (Migrated from github.com) reviewed 2026-04-24 13:50:02 +00:00
polespinasa (Migrated from github.com) left a comment

concept ACK

The refactor is nice and clean.

I think it is worth adding in the commit message that this refactor has a super super small performance downgrade, but we can take it as it is negligible. Now we don't early exit if we found any condition that tells us that a coin is spent.

concept ACK The refactor is nice and clean. I think it is worth adding in the commit message that this refactor has a super super small performance downgrade, but we can take it as it is negligible. Now we don't early exit if we found any condition that tells us that a coin is spent.
polespinasa (Migrated from github.com) commented 2026-04-24 13:46:16 +00:00

Given that it is a one-line function I think is fine to remove it from wallet.cpp and add the logic in wallet.h

Given that it is a one-line function I think is fine to remove it from wallet.cpp and add the logic in wallet.h
polespinasa (Migrated from github.com) reviewed 2026-04-24 13:57:56 +00:00
polespinasa (Migrated from github.com) commented 2026-04-24 13:57:56 +00:00

I don't think the changes inside HowSpent are necessary. It can distract from what is really being changed.

I don't think the changes inside HowSpent are necessary. It can distract from what is really being changed.
musaHaruna (Migrated from github.com) reviewed 2026-04-24 14:00:06 +00:00
musaHaruna (Migrated from github.com) commented 2026-04-24 14:00:06 +00:00

What if I move the change to a separate commit and update everything appropriately?
Would that work?

What if I move the change to a separate commit and update everything appropriately? Would that work?
polespinasa (Migrated from github.com) reviewed 2026-04-24 14:04:24 +00:00
polespinasa (Migrated from github.com) commented 2026-04-24 14:04:24 +00:00

It's just the changes are not necessary for the PR. To simplify IsSpent() you don't need to touch HowSpent().

I don't agree with them anyway. I am not a super fan of using auto it makes code less readable as you don't know what you are using. But that's a personal opinion.

It's just the changes are not necessary for the PR. To simplify `IsSpent()` you don't need to touch `HowSpent()`. I don't agree with them anyway. I am not a super fan of using `auto` it makes code less readable as you don't know what you are using. But that's a personal opinion.
musaHaruna (Migrated from github.com) reviewed 2026-04-24 14:08:40 +00:00
musaHaruna (Migrated from github.com) commented 2026-04-24 14:08:40 +00:00

Yeah. Also not a big fan of using auto.
I will address all the suggestion in the next push.
Thank you for the review.

Yeah. Also not a big fan of using `auto`. I will address all the suggestion in the next push. Thank you for the review.
musaHaruna commented 2026-04-24 15:09:54 +00:00 (Migrated from github.com)

Force pushed 8722fad

I think it is worth adding in the commit message that this refactor has a super super small performance downgrade, but we can take it as it is negligible. Now we don't early exit if we found any condition that tells us that a coin is spent.

Updated the commit message as suggested.

Given that it is a one-line function I think is fine to remove it from wallet.cpp and add the logic in wallet.h

Move CWallet::IsSpent from wallet.cpp to wallet.h

Force pushed [8722fad](https://github.com/bitcoin/bitcoin/pull/35151/commits/8722fad4619ccfd3e3bd5036725ac2176dafadc4) > I think it is worth adding in the commit message that this refactor has a super super small performance downgrade, but we can take it as it is negligible. Now we don't early exit if we found any condition that tells us that a coin is spent. Updated the commit message as suggested. > Given that it is a one-line function I think is fine to remove it from wallet.cpp and add the logic in wallet.h Move `CWallet::IsSpent` from wallet.cpp to wallet.h
polespinasa (Migrated from github.com) reviewed 2026-04-24 15:42:48 +00:00
polespinasa (Migrated from github.com) commented 2026-04-24 15:42:48 +00:00

There's an extra space here, that breaks the lint.
I think you can do a one line to occupy less space, similar to SteadyClock::duration ScanningDuration():

    /** Outpoint is spent if any non-conflicted transaction spends it */
    bool IsSpent(const COutPoint& outpoint) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { return HowSpent(outpoint) != SpendType::UNSPENT; }
There's an extra space here, that breaks the lint. I think you can do a one line to occupy less space, similar to `SteadyClock::duration ScanningDuration()`: ```c++ /** Outpoint is spent if any non-conflicted transaction spends it */ bool IsSpent(const COutPoint& outpoint) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { return HowSpent(outpoint) != SpendType::UNSPENT; } ```
DrahtBot commented 2026-04-24 15:56:33 +00:00 (Migrated from github.com)

🚧 At least one of the CI tasks failed.
Task lint: https://github.com/bitcoin/bitcoin/actions/runs/24896525104/job/72902929770
LLM reason (✨ experimental): CI failed because the trailing_whitespace lint check detected trailing whitespace in src/wallet/wallet.h (line 569).

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.

<!--85328a0da195eb286784d51f73fa0af9--> 🚧 At least one of the CI tasks failed. <sub>Task `lint`: https://github.com/bitcoin/bitcoin/actions/runs/24896525104/job/72902929770</sub> <sub>LLM reason (✨ experimental): CI failed because the `trailing_whitespace` lint check detected trailing whitespace in `src/wallet/wallet.h` (line 569).</sub> <details><summary>Hints</summary> 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. </details>
musaHaruna (Migrated from github.com) reviewed 2026-04-25 10:00:21 +00:00
musaHaruna (Migrated from github.com) commented 2026-04-25 10:00:21 +00:00

Fixed. Thank you!

Fixed. Thank you!
luke-jr commented 2026-04-25 18:54:51 +00:00 (Migrated from github.com)

Concept NACK. You've made it much less efficient. Not only does it perform more checks, it also doesn't exit the loop early.

Concept NACK. You've made it much less efficient. Not only does it perform more checks, it also doesn't exit the loop early.
polespinasa commented 2026-04-27 09:45:52 +00:00 (Migrated from github.com)

Not only does it perform more checks

I don't think the extra checks is a performance decrease. If I am not mistaken isConfirmed() and InMempool() only read a value already loaded in CWalletTx.

it also doesn't exit the loop early.

I am not sure how bad it would be to ignore the early exit. But anyway it's easily solvable by adding a bool arg saying if we are checking for the exact HowSpent or only if IsSpent.

    SpendType HowSpent(const COutPoint& outpoint, const bool isSpent = false) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);

    /** Outpoint is spent if any non-conflicted transaction spends it */
    bool IsSpent(const COutPoint& outpoint) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { return HowSpent(outpoint, /*isSpent=*/true) != SpendType::UNSPENT; }
CWallet::SpendType CWallet::HowSpent(const COutPoint& outpoint, bool isSpent) const
{
    SpendType st{SpendType::UNSPENT};

    std::pair<TxSpends::const_iterator, TxSpends::const_iterator> range;
    range = mapTxSpends.equal_range(outpoint);

    for (TxSpends::const_iterator it = range.first; it != range.second; ++it) {
        const Txid& txid = it->second;
        const auto mit = mapWallet.find(txid);
        if (mit != mapWallet.end()) {
            const auto& wtx = mit->second;
            if (wtx.isConfirmed()) return SpendType::CONFIRMED;
            if (wtx.InMempool()) {
                st = SpendType::MEMPOOL;
            } else if (!wtx.isAbandoned() && !wtx.isBlockConflicted() && !wtx.isMempoolConflicted()) {
                if (st == SpendType::UNSPENT) st = SpendType::NONMEMPOOL;
            }
            // If we are only checking for spent condition and not how the coin is spent
            // early exit as fast as we know if it is spent.
            if (isSpent && st != SpendType::UNSPENT) return st;
        }
    }
    return st;
}
> Not only does it perform more checks I don't think the extra checks is a performance decrease. If I am not mistaken `isConfirmed()` and `InMempool()` only read a value already loaded in `CWalletTx`. > it also doesn't exit the loop early. I am not sure how bad it would be to ignore the early exit. But anyway it's easily solvable by adding a bool arg saying if we are checking for the exact `HowSpent` or only if `IsSpent`. ```c++ SpendType HowSpent(const COutPoint& outpoint, const bool isSpent = false) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); /** Outpoint is spent if any non-conflicted transaction spends it */ bool IsSpent(const COutPoint& outpoint) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { return HowSpent(outpoint, /*isSpent=*/true) != SpendType::UNSPENT; } ``` ```c++ CWallet::SpendType CWallet::HowSpent(const COutPoint& outpoint, bool isSpent) const { SpendType st{SpendType::UNSPENT}; std::pair<TxSpends::const_iterator, TxSpends::const_iterator> range; range = mapTxSpends.equal_range(outpoint); for (TxSpends::const_iterator it = range.first; it != range.second; ++it) { const Txid& txid = it->second; const auto mit = mapWallet.find(txid); if (mit != mapWallet.end()) { const auto& wtx = mit->second; if (wtx.isConfirmed()) return SpendType::CONFIRMED; if (wtx.InMempool()) { st = SpendType::MEMPOOL; } else if (!wtx.isAbandoned() && !wtx.isBlockConflicted() && !wtx.isMempoolConflicted()) { if (st == SpendType::UNSPENT) st = SpendType::NONMEMPOOL; } // If we are only checking for spent condition and not how the coin is spent // early exit as fast as we know if it is spent. if (isSpent && st != SpendType::UNSPENT) return st; } } return st; } ```
DrahtBot commented 2026-04-30 15:41:34 +00:00 (Migrated from github.com)

🚧 At least one of the CI tasks failed.
Task tidy: https://github.com/bitcoin/bitcoin/actions/runs/25172360438/job/73795063472
LLM reason (✨ experimental): CI failed due to a clang-tidy error (readability-avoid-const-params-in-decls) in wallet/wallet.h where parameter isSpent is const-qualified in the declaration.

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.

<!--85328a0da195eb286784d51f73fa0af9--> 🚧 At least one of the CI tasks failed. <sub>Task `tidy`: https://github.com/bitcoin/bitcoin/actions/runs/25172360438/job/73795063472</sub> <sub>LLM reason (✨ experimental): CI failed due to a clang-tidy error (`readability-avoid-const-params-in-decls`) in `wallet/wallet.h` where parameter `isSpent` is const-qualified in the declaration.</sub> <details><summary>Hints</summary> 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. </details>
musaHaruna (Migrated from github.com) reviewed 2026-04-30 17:15:37 +00:00
musaHaruna (Migrated from github.com) left a comment

Added commit 775964e as suggested by @polespinasa to address the early-exit concern raised in review.

HowSpent now takes an optional isSpent flag, allowing it to return early when used by IsSpent, restoring the previous early-exit behavior while still keeping the refactor.

Thank you so much @polespinasa for the reviews and suggestions.
I will keep the changes like this to see what other reviewers thinks about it.

Added commit [775964e](https://github.com/bitcoin/bitcoin/pull/35151/commits/775964ef02e8e8c85ea2caf01b76e41a454212f6) as suggested by @polespinasa to address the early-exit concern raised in review. `HowSpent` now takes an optional `isSpent` flag, allowing it to return early when used by IsSpent, restoring the previous early-exit behavior while still keeping the refactor. Thank you so much @polespinasa for the reviews and suggestions. I will keep the changes like this to see what other reviewers thinks about it.
polespinasa commented 2026-04-30 18:15:09 +00:00 (Migrated from github.com)

Great!

The commits can be squashed into one single commit. Each commit should be good for himself and the first one is a behavior change so it needs the changes in the second :)

Great! The commits can be squashed into one single commit. Each commit should be good for himself and the first one is a behavior change so it needs the changes in the second :)
musaHaruna (Migrated from github.com) reviewed 2026-05-05 09:37:37 +00:00
musaHaruna (Migrated from github.com) left a comment

Great!

The commits can be squashed into one single commit. Each commit should be good for himself and the first one is a behavior change so it needs the changes in the second :)

Squashed. Thanks.

> Great! > > The commits can be squashed into one single commit. Each commit should be good for himself and the first one is a behavior change so it needs the changes in the second :) Squashed. Thanks.
polespinasa (Migrated from github.com) reviewed 2026-08-11 09:59:35 +00:00
polespinasa (Migrated from github.com) left a comment

ACK ac774b3184

I am not sure about the bool variable name isSpent. It does not self-explain what it does. But anything like only_check_if_spent might be too much.

The comment later in the code makes it clear and because the code function is not large I think this is not a big problem.

ACK ac774b318440c7cc4804516b1f811005e25e8d45 I am not sure about the bool variable name `isSpent`. It does not self-explain what it does. But anything like `only_check_if_spent` might be too much. The comment later in the code makes it clear and because the code function is not large I think this is not a big problem.
First-time contributor

No verified findings are available from this review.

Review coverage was incomplete.


Reviewed: ac774b318440 · Full review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:4d44b6ffa09c54db24f8f0ab27ae388beae06a733efcae741ca64db76bb1c938:7efd3c3ba41667382004cfa7a7db56605da7d8f9b7ab69bc483f27117390ba48 --> <!-- ralph-base:eb1b70d8431ff005b2321066b00b026876d9eadc --> <!-- ralph-head:ac774b318440c7cc4804516b1f811005e25e8d45 --> <!-- ralph-case:94dea0e9662d7b7d312516996ae9ad7767477d6e33c957b1bd1cb8c5f383fc96 --> No verified findings are available from this review. Review coverage was incomplete. <!-- Review tier: sensitive --> --- Reviewed: [`ac774b318440`](<https://git.fish.foo/bitcoin/bitcoin/commit/ac774b318440c7cc4804516b1f811005e25e8d45>) · [Full review report](<https://review.fish.foo/traces/35151-ac774b318440c7cc4804516b1f811005e25e8d45-2117-1.html>) · [Previous reports](<https://review.fish.foo/traces/35151/>) [permalink](<https://review.fish.foo/traces/35151-ac774b318440c7cc4804516b1f811005e25e8d45-2117-1.html>)
pablomartin4btc (Migrated from github.com) reviewed 2026-12-03 04:40:24 +00:00
pablomartin4btc (Migrated from github.com) left a comment

Concept ACK

Not strictly a pure refactor: previously a spend counted only if the spending tx was not abandoned, block-conflicted or mempool-conflicted; now a confirmed or in-mempool spending tx counts first. These only differ for a confirmed/ in-mempool tx with non-empty mempool_conflicts, which I don't think can happen in practice (RBF and TRUC sibling eviction both look fine), but it'd be good to mention in the commit message, or add a small unit test checking IsSpent() and HowSpent() != SpendType::UNSPENT agree across tx states.

Concept ACK Not strictly a pure refactor: previously a spend counted only if the spending tx was not abandoned, block-conflicted or mempool-conflicted; now a confirmed or in-mempool spending tx counts first. These only differ for a confirmed/ in-mempool tx with non-empty `mempool_conflicts`, which I don't think can happen in practice (RBF and TRUC sibling eviction both look fine), but it'd be good to mention in the commit message, or add a small unit test checking `IsSpent()` and `HowSpent() != SpendType::UNSPENT` agree across tx states.
pablomartin4btc (Migrated from github.com) commented 2026-12-03 04:38:07 +00:00

nit: per developer-notes, function args should be snake_case. Also, since with this flag set HowSpent returns as soon as any spend is found (e.g. MEMPOOL even if a later spend is CONFIRMED), the returned SpendType is only meaningful as spent/unspent. Maybe a name that reflects that and a short doc comment, e.g.:

    /** If stop_at_first_spend is set, return as soon as any spend is found; the exact SpendType is then not meaningful. */
    SpendType HowSpent(const COutPoint& outpoint, bool stop_at_first_spend = false) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);

Alternatively keep the public HowSpent(outpoint) as-is and move the flagged version into a private helper.

nit: per developer-notes, function args should be snake_case. Also, since with this flag set `HowSpent` returns as soon as any spend is found (e.g. `MEMPOOL` even if a later spend is `CONFIRMED`), the returned `SpendType` is only meaningful as spent/unspent. Maybe a name that reflects that and a short doc comment, e.g.: ```suggestion /** If stop_at_first_spend is set, return as soon as any spend is found; the exact SpendType is then not meaningful. */ SpendType HowSpent(const COutPoint& outpoint, bool stop_at_first_spend = false) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); ``` Alternatively keep the public `HowSpent(outpoint)` as-is and move the flagged version into a private helper.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!35151
No description provided.