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:
authorBitflash <admin@bitflash.network>2026-08-18 15:48:17 -0300
committerBitflash <admin@bitflash.network>2026-08-18 15:48:17 -0300
commitf3fb7ce6759ac98a7cc39d586fc2824982c74acd (patch)
tree23e39a26b340324a7a33a115aded3b70b5332816 /src/db.h
parentbeb5c1435a0d85b7b24d4d371933758ebed90907 (diff)
parent84a60275569dca5d1fb12db38ce184caf7487ed6 (diff)
Merge pull request 'wallet: complete SQLite backend activation (encrypt, atomicity, one-shot commands)' (#61) from wallet-sqlite-encrypt into main
Diffstat (limited to 'src/db.h')
-rw-r--r--src/db.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/db.h b/src/db.h
index fee5a82..5bc94b1 100644
--- a/src/db.h
+++ b/src/db.h
@@ -365,6 +365,11 @@ bool WalletSQLiteRuntimeWriteRecord(const vector<unsigned char>& vchKey,
365 const vector<unsigned char>& vchValue, 365 const vector<unsigned char>& vchValue,
366 bool fOverwrite); 366 bool fOverwrite);
367bool WalletSQLiteRuntimeEraseRecord(const vector<unsigned char>& vchKey); 367bool WalletSQLiteRuntimeEraseRecord(const vector<unsigned char>& vchKey);
368bool WalletSQLiteRuntimeBeginTxn();
369bool WalletSQLiteRuntimeCommitTxn();
370void WalletSQLiteRuntimeRollbackTxn();
371bool WalletSQLiteRuntimeOpenReadOnly(const string& strPath, string& strErrorRet);
372bool WalletSQLiteRuntimeCheckpoint(string& strErrorRet);
368 373
369 374
370 375
@@ -531,8 +536,21 @@ public:
531 536
532 bool WriteHDMaster(const vector<unsigned char>& vchMaster, const vector<unsigned char>& vchChainCode) 537 bool WriteHDMaster(const vector<unsigned char>& vchMaster, const vector<unsigned char>& vchChainCode)
533 { 538 {
534 return WriteWalletRecord(string("hdmaster"), vchMaster) 539 // hdmaster and hdchaincode are halves of one seed: a wallet with one but
535 && WriteWalletRecord(string("hdchaincode"), vchChainCode); 540 // not the other is an incomplete HD wallet (-walletstoragecheck flags
541 // exactly that). Under the SQLite runtime write them in one transaction
542 // so a failure or crash between the two cannot leave that half-state.
543 // Berkeley DB keeps its existing per-write behaviour -- the bracket is a
544 // no-op there.
545 if (!WalletSQLiteRuntimeBeginTxn())
546 return false;
547 if (!WriteWalletRecord(string("hdmaster"), vchMaster) ||
548 !WriteWalletRecord(string("hdchaincode"), vchChainCode))
549 {
550 WalletSQLiteRuntimeRollbackTxn();
551 return false;
552 }
553 return WalletSQLiteRuntimeCommitTxn();
536 } 554 }
537 555
538 bool WriteWalletMinVersion(int nVersion) 556 bool WriteWalletMinVersion(int nVersion)