Skip to content

Remove dead wallet version-gating code (#405)#443

Merged
azuchi merged 1 commit into
chaintope:masterfrom
Naviabheeman:WalletVersionCleanup
Jul 15, 2026
Merged

Remove dead wallet version-gating code (#405)#443
azuchi merged 1 commit into
chaintope:masterfrom
Naviabheeman:WalletVersionCleanup

Conversation

@Naviabheeman

Copy link
Copy Markdown
Contributor

Every WalletFeature constant was collapsed to FEATURE_BASE = 10500, making CanSupportFeature() always true, SetMinVersion() a permanent no-op, and every version-conditional branch's else-arm unreachable.

  • Collapse the WalletFeature enum to FEATURE_BASE/FEATURE_LATEST only; delete the six intermediate constants inherited from Bitcoin Core that were never meaningful in Tapyrus.
  • Remove CanSupportFeature(), SetMaxVersion(), and nWalletMaxVersion; simplify SetMinVersion() to just write the version when it advances.
  • Drop the dead uncompressed-key branch in GenerateNewKey() and a tautological assert in DeriveNewChildKey() (Tapyrus always uses compressed keys and HD chain split).
  • Collapse the now-always-true CanSupportFeature(FEATURE_HD_SPLIT) conjuncts in SetHDSeed/TopUpKeyPool/ReserveKeyFromKeyPool/ GetOldestKeyPoolTime/getwalletinfo down to their genuinely conditional IsHDEnabled() checks.
  • Keep the SetMinVersion(FEATURE_BASE, ...) calls in EncryptWallet and the -upgradewallet HD-upgrade path: these aren't dead for a wallet loaded from an older/foreign wallet.dat with a stored version below FEATURE_BASE.

Introducing a new wallet-format version tied to coloured-coin GUI support (steps 2/3/8 of the #405 recommendation) is not needed as no such on-disk format change exists.

Every WalletFeature constant was collapsed to FEATURE_BASE = 10500,
making CanSupportFeature() always true, SetMinVersion() a permanent
no-op, and every version-conditional branch's else-arm unreachable.

- Collapse the WalletFeature enum to FEATURE_BASE/FEATURE_LATEST only;
  delete the six intermediate constants inherited from Bitcoin Core
  that were never meaningful in Tapyrus.
- Remove CanSupportFeature(), SetMaxVersion(), and nWalletMaxVersion;
  simplify SetMinVersion() to just write the version when it advances.
- Drop the dead uncompressed-key branch in GenerateNewKey() and a
  tautological assert in DeriveNewChildKey() (Tapyrus always uses
  compressed keys and HD chain split).
- Collapse the now-always-true CanSupportFeature(FEATURE_HD_SPLIT)
  conjuncts in SetHDSeed/TopUpKeyPool/ReserveKeyFromKeyPool/
  GetOldestKeyPoolTime/getwalletinfo down to their genuinely
  conditional IsHDEnabled() checks.
- Keep the SetMinVersion(FEATURE_BASE, ...) calls in EncryptWallet and
  the -upgradewallet HD-upgrade path: these aren't dead for a wallet
  loaded from an older/foreign wallet.dat with a stored version below
  FEATURE_BASE.

Introducing a new wallet-format version tied to coloured-coin GUI
support (steps 2/3/8 of the chaintope#405 recommendation) is deferred: no such
on-disk format change exists anywhere in the repo today, so there is
nothing yet for a version bump to gate.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@azuchi
azuchi merged commit 2ffac2b into chaintope:master Jul 15, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants