AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 18 Bitcoin

Merge bitcoin/bitcoin#36230: wallet: Improve `HasWalletDescriptor` performance and other canonical descriptor string followups

Public commit record

What the developer wrote

Authored by merge-script

100/100 · Strong
Merge bitcoin/bitcoin#36230: wallet: Improve `HasWalletDescriptor` performance and other canonical descriptor string followups

61edcf92532502e91c2e17b8c2a23b45f5773936 test: Add 31.1 to wallet back compat (Ava Chow)
ebf2f69ee81925057cdcc881e42e861dbdf39ae5 test: Simplify miniscript descriptor check in wallet back compat (Ava Chow)
f6cbcfd98a000deb17521520074ba46965c410b1 wallet: Document WalletDescriptor::UpdateFrom (Ava Chow)
f0f6dce849634e801ac81705176ca8b96abbaa09 descriptor, doc: Clarify miniscript CompatDescriptorHash (Ava Chow)
405b1d6055e78866fe2d86ba6fb16534f9554a32 descriptor: Explicitly handle use_apostrophe cases (Ava Chow)
64abb3e8d3610449d541bfff2db23b9ace3fa111 wallet: Compare descriptors by hash of canonical string (Ava Chow)
bb5e8320d76f5175fdf86bdc4c2d24bfc1eed438 wallet: Make WalletDescriptor's descriptor const (Ava Chow)
4cc00f7bc04b4c07827728ba5ce1094b338a76a8 wallet: Remove WalletDescriptor's default constructor (Ava Chow)

Pull request description:

Instead of re-computing the canonical descriptor string for every call to `HasWalletDescriptor`. `WalletDescriptor` will now compute it once upon construction and cache the hash of that string. The comparison uses a new `WalletDescriptor::Equals` function which compares the canonical string hashes. The hash is used to avoid holding possibly a large amount of memory for a string that is rarely used. This should fix the performance regression described in https://github.com/bitcoin/bitcoin/pull/35445#issuecomment-5633483553

Also addresses several review comments related to documentation and code readability:
- https://github.com/bitcoin/bitcoin/pull/35445#discussion_r3924705885
- https://github.com/bitcoin/bitcoin/pull/35445#discussion_r3924785232
- https://github.com/bitcoin/bitcoin/pull/35445#discussion_r3925352894
- https://github.com/bitcoin/bitcoin/pull/35445#discussion_r3925462409
- https://github.com/bitcoin/bitcoin/pull/35445#discussion_r3937800942
- https://github.com/bitcoin/bitcoin/pull/35445#discussion_r3961028442

ACKs for top commit:
Sjors:
ACK 61edcf92532502e91c2e17b8c2a23b45f5773936
polespinasa:
ACK 61edcf92532502e91c2e17b8c2a23b45f5773936

Tree-SHA512: d13057cdfa89f9831950502f19159a40ca1da693f47d8ae63613fbc74b588994f6748b9124947b29ad1f035cff6650f8ae3d7396025a2363fcf3d32de002adf1
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This is a Bitcoin Core wallet maintenance patch. It speeds up a wallet function that checks whether a descriptor already exists by caching a hash of the descriptor's canonical text, instead of rebuilding that text every time. It also tidies up serialization code, removes a default constructor, and adds v31.1 to backwards-compatibility tests. There is no indication this fixes an exploitable security bug.

Recommended action

No security action required. Treat as normal code-quality/performance maintenance. Reviewers may want to verify that the cached canonical hash is invalidated or recomputed correctly if descriptor state ever changes, but the descriptor is now const and the hash is computed lazily, so this appears safe.

Security signals we found

01

No security-relevant signal in commit message or diff

02

Change is described as performance improvement and code cleanup

03

Backwards-compatibility test notes a known miniscript wallet loading incompatibility between v31.0/v31.1 and other versions, but this is a documented compatibility quirk, not a vulnerability

Risk score

Why this scored 18/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 5/15
Confidence 9/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.