diff options
| author | Bitflash <btf01@proton.me> | 2026-08-01 17:53:17 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-01 17:53:17 -0300 |
| commit | ce59d8c72c667ce638bd12f37db26d8b3408a5d2 (patch) | |
| tree | 95c62a0d0cc0a21bc3349264ce0a3c949deb32c3 /src/db.cpp | |
| parent | 593cf346dbce0a8ce46a13a73a4f78ddd044ab52 (diff) | |
wallet: derive the key pool from a seed, so a phrase could bring it back (#93)
Adds BIP32 derivation behind the wallet key pool, with no user-facing way to create a seed yet. wallet.dat gains hdmaster/hdchaincode/hdnext; the mnemonic is never stored. TopUpKeyPool derives m/n' when a seed exists and falls back to a random key, with a log line, if derivation fails. New -selftest=wallet-hd, wired into make tests on both platforms.
Diffstat (limited to 'src/db.cpp')
| -rw-r--r-- | src/db.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
| @@ -639,6 +639,18 @@ bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet) | |||
| 639 | { | 639 | { |
| 640 | ssValue >> vchDefaultKeyRet; | 640 | ssValue >> vchDefaultKeyRet; |
| 641 | } | 641 | } |
| 642 | else if (strType == "hdmaster") | ||
| 643 | { | ||
| 644 | ssValue >> vchHDMaster; | ||
| 645 | } | ||
| 646 | else if (strType == "hdchaincode") | ||
| 647 | { | ||
| 648 | ssValue >> vchHDChainCode; | ||
| 649 | } | ||
| 650 | else if (strType == "hdnext") | ||
| 651 | { | ||
| 652 | ssValue >> nHDNext; | ||
| 653 | } | ||
| 642 | else if (strType == "pool") | 654 | else if (strType == "pool") |
| 643 | { | 655 | { |
| 644 | int64 nIndex; | 656 | int64 nIndex; |