Review report

core: PR #32895

🟡 Minor

Feature records are written even when an upgrade fails (src/wallet/walletdb.cpp:1263, head)

If UpgradeDescriptorCache() throws, the catch above sets result to DBErrors::CORRUPT, but execution still reaches this feature write before returning the error. The wallet is therefore recorded as having opened with these features even though loading failed. If feature bits determine whether automatic upgrades run, a later attempt could treat the failed upgrade as supported and skip retrying it. Write the feature record only after the upgrade succeeds.

💡 Suggestion

Test the downgrade feature-record transition (test/functional/wallet_createwallet.py:196, head)

The added test checks the version log value but does not cover the downgrade-recovery behavior implemented in LoadWallet. Add a database regression test that seeds a pre-feature VERSION and stale LAST_DECRYPTED_FEATURES, verifies that loading discards the stale record, then unlocks the wallet and verifies that it writes the current decrypted-features record. This would directly exercise the new persistence ordering without changing wallet behavior.

Review coverage was incomplete. The adversarial review had incomplete evidence.