upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/db.h
diff options
context:
space:
mode:
authormtg0001 <106211915+mtg0001@users.noreply.github.com>2026-08-03 15:11:55 -0300
committerGitHub <noreply@github.com>2026-08-03 15:11:55 -0300
commitaba252206bf39ac81e6627354062c28fae05b0aa (patch)
tree751691f0baaf925c54a2c03f9f02ca87fb29956f /src/db.h
parent1aee805b232a33484e3db1dc8ea4bfb3f585212e (diff)
Activate BIP44 wallet derivation (#124)
* Add BIP32 path derivation foundation * Add HD wallet schema metadata * Add provisional BIP44 coin type metadata * Activate BIP44 wallet derivation * wallet: scan BIP44 restore depth per branch * wallet: widen default BIP44 restore lookahead --------- Co-authored-by: Gilcimar Duarte <ti@gpm.infra>
Diffstat (limited to 'src/db.h')
-rw-r--r--src/db.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/db.h b/src/db.h
index 01b8583..90238bf 100644
--- a/src/db.h
+++ b/src/db.h
@@ -392,8 +392,11 @@ public:
392 // twelve words are the user's to write down, and keeping a copy of them in 392 // twelve words are the user's to write down, and keeping a copy of them in
393 // the file they are meant to protect defeats the point of having them. 393 // the file they are meant to protect defeats the point of having them.
394 // 394 //
395 // "hdnext" is the next child index to derive, so the sequence a restore 395 // "hdschema" identifies the derivation layout. Wallets created before the
396 // reproduces is the same one this wallet handed out. 396 // field existed are inferred as HD_SCHEMA_LEGACY when a seed is present.
397 // "hdnext" is that legacy layout's next child index. The receive/change
398 // counters and coin type are reserved for the BIP44 layout that uses
399 // separate chains.
397 bool ReadHDMaster(vector<unsigned char>& vchMasterRet, vector<unsigned char>& vchChainCodeRet) 400 bool ReadHDMaster(vector<unsigned char>& vchMasterRet, vector<unsigned char>& vchChainCodeRet)
398 { 401 {
399 vchMasterRet.clear(); 402 vchMasterRet.clear();
@@ -413,6 +416,26 @@ public:
413 return Write(string("hdnext"), nNext); 416 return Write(string("hdnext"), nNext);
414 } 417 }
415 418
419 bool WriteHDSchema(int nSchema)
420 {
421 return Write(string("hdschema"), nSchema);
422 }
423
424 bool WriteHDCoinType(unsigned int nCoinType)
425 {
426 return Write(string("hdcointype"), nCoinType);
427 }
428
429 bool WriteHDReceiveNext(unsigned int nNext)
430 {
431 return Write(string("hdreceivenext"), nNext);
432 }
433
434 bool WriteHDChangeNext(unsigned int nNext)
435 {
436 return Write(string("hdchangenext"), nNext);
437 }
438
416 // Keys generated ahead of time and not yet handed out. The private key of 439 // Keys generated ahead of time and not yet handed out. The private key of
417 // each is already stored under its own "key" record by AddKey; a "pool" 440 // each is already stored under its own "key" record by AddKey; a "pool"
418 // record only says that this one is still unspoken for. 441 // record only says that this one is still unspoken for.