diff options
| author | mtg0001 <106211915+mtg0001@users.noreply.github.com> | 2026-08-01 21:43:45 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-01 21:43:45 -0300 |
| commit | 5a5478669c487963e99491112abc065c59973966 (patch) | |
| tree | e2e73a4e2283c5dae4fa342ec98cdf8d719017ca /src/main.h | |
| parent | fc071066c9de259795a210e449b364ac126416ad (diff) | |
Keep new phrase addresses recoverable (#102)
-newphrase installed a seed but left the wallet's visible address as the pre-seed random key and the old random pool intact, so the next address handed out -- a mining payout included -- could be one the twelve words cannot reproduce, while the window said a recovery phrase existed. Installing a phrase now clears the stale pool records (private keys stay in wallet.dat), reserves a derived default receiving key, tolerates already-stored derived keys so repeated installs do not stall the pool, and -restorephrase reports what it recovered rather than the wallet's total transaction count. Self-test covers installing a phrase over a pre-existing random pool.
Diffstat (limited to 'src/main.h')
| -rw-r--r-- | src/main.h | 5 |
1 files changed, 3 insertions, 2 deletions
| @@ -159,8 +159,9 @@ extern vector<unsigned char> vchHDChainCode; // 32 bytes (IR) | |||
| 159 | extern unsigned int nHDNext; // next child index to derive | 159 | extern unsigned int nHDNext; // next child index to derive |
| 160 | inline bool HaveHDSeed() { return vchHDMaster.size() == 32 && vchHDChainCode.size() == 32; } | 160 | inline bool HaveHDSeed() { return vchHDMaster.size() == 32 && vchHDChainCode.size() == 32; } |
| 161 | 161 | ||
| 162 | // Install a seed derived from a mnemonic, replacing any existing one, and reset | 162 | // Install a seed derived from a mnemonic, replacing any existing one. The |
| 163 | // the derivation counter. Writes to wallet.dat. Returns false and leaves the | 163 | // default receiving key is derived immediately, so the next visible address is |
| 164 | // covered by the phrase. Writes to wallet.dat. Returns false and leaves the | ||
| 164 | // wallet untouched if the phrase is not valid. | 165 | // wallet untouched if the phrase is not valid. |
| 165 | bool SetHDSeedFromMnemonic(const string& strMnemonic, string& strErrorRet); | 166 | bool SetHDSeedFromMnemonic(const string& strMnemonic, string& strErrorRet); |
| 166 | 167 | ||