upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/main_gui.cpp
diff options
context:
space:
mode:
authorBitflash <btf01@proton.me>2026-08-01 17:53:17 -0300
committerGitHub <noreply@github.com>2026-08-01 17:53:17 -0300
commitce59d8c72c667ce638bd12f37db26d8b3408a5d2 (patch)
tree95c62a0d0cc0a21bc3349264ce0a3c949deb32c3 /src/main_gui.cpp
parent593cf346dbce0a8ce46a13a73a4f78ddd044ab52 (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/main_gui.cpp')
-rw-r--r--src/main_gui.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 2bcdb83..aa9c23d 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -323,6 +323,16 @@ int main(int argc, char* argv[])
323 // import having failed. 323 // import having failed.
324 if (nAdded > 0) 324 if (nAdded > 0)
325 { 325 {
326 string strScanError;
327 if (!CanScanWalletTransactions(strScanError))
328 {
329 fprintf(stderr, "Cannot scan for imported coins: %s\n",
330 strScanError.c_str());
331 fprintf(stderr, "The key import was written, but the wallet "
332 "balance was not proven against the chain.\n");
333 DBFlush(true);
334 return 1;
335 }
326 printf("Looking through the chain for coins belonging to the imported key(s)...\n"); 336 printf("Looking through the chain for coins belonging to the imported key(s)...\n");
327 int nFound = ScanForWalletTransactions(pindexGenesisBlock); 337 int nFound = ScanForWalletTransactions(pindexGenesisBlock);
328 printf("Found %d transaction(s). Start the node normally to see the balance.\n", nFound); 338 printf("Found %d transaction(s). Start the node normally to see the balance.\n", nFound);
@@ -339,6 +349,14 @@ int main(int argc, char* argv[])
339 // balance is wrong for this reason. 349 // balance is wrong for this reason.
340 if (arg(argc,argv,"/rescan") || arg(argc,argv,"-rescan")) 350 if (arg(argc,argv,"/rescan") || arg(argc,argv,"-rescan"))
341 { 351 {
352 string strScanError;
353 if (!CanScanWalletTransactions(strScanError))
354 {
355 fprintf(stderr, "Cannot rescan wallet transactions: %s\n",
356 strScanError.c_str());
357 DBFlush(true);
358 return 1;
359 }
342 printf("Rescanning the chain for this wallet's transactions...\n"); 360 printf("Rescanning the chain for this wallet's transactions...\n");
343 int nFound = ScanForWalletTransactions(pindexGenesisBlock); 361 int nFound = ScanForWalletTransactions(pindexGenesisBlock);
344 printf("Rescan done: %d transaction(s) added or updated.\n", nFound); 362 printf("Rescan done: %d transaction(s) added or updated.\n", nFound);