aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/walletdb.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/walletdb.h')
-rw-r--r--src/wallet/walletdb.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h
index dad0b18a78..9474a59660 100644
--- a/src/wallet/walletdb.h
+++ b/src/wallet/walletdb.h
@@ -275,8 +275,6 @@ public:
bool EraseActiveScriptPubKeyMan(uint8_t type, bool internal);
DBErrors LoadWallet(CWallet* pwallet);
- DBErrors FindWalletTxHashes(std::vector<uint256>& tx_hashes);
- DBErrors ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut);
//! write the hdchain model (external chain child index counter)
bool WriteHDChain(const CHDChain& chain);
@@ -296,6 +294,20 @@ private:
WalletDatabase& m_database;
};
+/**
+ * Executes the provided function 'func' within a database transaction context.
+ *
+ * This function ensures that all db modifications performed within 'func()' are
+ * atomically committed to the db at the end of the process. And, in case of a
+ * failure during execution, all performed changes are rolled back.
+ *
+ * @param database The db connection instance to perform the transaction on.
+ * @param process_desc A description of the process being executed, used for logging purposes in the event of a failure.
+ * @param func The function to be executed within the db txn context. It returns a boolean indicating whether to commit or roll back the txn.
+ * @return true if the db txn executed successfully, false otherwise.
+ */
+bool RunWithinTxn(WalletDatabase& database, std::string_view process_desc, const std::function<bool(WalletBatch&)>& func);
+
//! Compacts BDB state so that wallet.dat is self-contained (if there are changes)
void MaybeCompactWalletDB(WalletContext& context);