Skip to content

keystore: Old_KeyStore: allow odd-length hex seeds - #11047

Open
fametrano wants to merge 1 commit into
spesmilo:masterfrom
fametrano:old-seed-odd-length
Open

fametrano wants to merge 1 commit into
spesmilo:masterfrom
fametrano:old-seed-odd-length

Conversation

@fametrano

Copy link
Copy Markdown
Contributor

Some pre-2.0 seeds decode to an odd number of hex digits: a word triple worth 2**32 or more takes 9 hex digits instead of 8. Since 4.6.1 Old_KeyStore requires even-length hex, so importing such a seed fails, and a wallet restored from one by an older version can no longer sign or change its password.

This makes Old_KeyStore accept any number of hex digits. An encrypted seed is base64, a multiple of 4 characters long, so it is still told apart from a plain one. The tests use the mpk, addresses and private key that 4.2.1 gives for the seed in #11045, and get_seed now gives a clear error for these seeds. I left alone the order in Abstract_Wallet.update_password, which sets the storage password before the keystore one. The fix already stops these wallets failing at the keystore step, and swapping the order alone would not make a password change atomic.

Fixes #11045.

An old seed decodes to an odd number of hex digits when one of its word
triples is worth 2**32 or more. Since 4.6.1 such seeds fail on import,
and wallets restored from them earlier can no longer sign. Accept them
again. get_seed now raises a clear error for them, as mn_encode cannot
encode them.

fixes spesmilo#11045
@fametrano
fametrano force-pushed the old-seed-odd-length branch from ab7ca79 to bf0f5d8 Compare October 23, 2026 23:59
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.

Certain old seeds can cause appearance of "An Error Occured" dialog during import

1 participant