upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
authormtg0001 <106211915+mtg0001@users.noreply.github.com>2026-08-01 21:43:45 -0300
committerGitHub <noreply@github.com>2026-08-01 21:43:45 -0300
commit5a5478669c487963e99491112abc065c59973966 (patch)
treee2e73a4e2283c5dae4fa342ec98cdf8d719017ca /src/main.h
parentfc071066c9de259795a210e449b364ac126416ad (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.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.h b/src/main.h
index a04a4e3..1b0be59 100644
--- a/src/main.h
+++ b/src/main.h
@@ -159,8 +159,9 @@ extern vector<unsigned char> vchHDChainCode; // 32 bytes (IR)
159extern unsigned int nHDNext; // next child index to derive 159extern unsigned int nHDNext; // next child index to derive
160inline bool HaveHDSeed() { return vchHDMaster.size() == 32 && vchHDChainCode.size() == 32; } 160inline 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.
165bool SetHDSeedFromMnemonic(const string& strMnemonic, string& strErrorRet); 166bool SetHDSeedFromMnemonic(const string& strMnemonic, string& strErrorRet);
166 167