aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api/wallet2_api.h
diff options
context:
space:
mode:
authorj-berman <justinberman@protonmail.com>2022-10-13 18:33:33 -0700
committerj-berman <justinberman@protonmail.com>2024-05-24 20:42:59 -0700
commite44e8b164030cfbddb9ae8b39251c1ccf396e2b6 (patch)
tree987d979f7d89e1515c57453b5b666a82b795f12e /src/wallet/api/wallet2_api.h
parent24ccaba6ef429fdd37a3281c586e655987201a5c (diff)
downloadmonzero-core-e44e8b164030cfbddb9ae8b39251c1ccf396e2b6.tar.gz
monzero-core-e44e8b164030cfbddb9ae8b39251c1ccf396e2b6.tar.xz
monzero-core-e44e8b164030cfbddb9ae8b39251c1ccf396e2b6.zip
wallet: background sync with just the view key
- When background syncing, the wallet wipes the spend key from memory and processes all new transactions. The wallet saves all receives, spends, and "plausible" spends of receives the wallet does not know key images for. - When background sync disabled, the wallet processes all background synced txs and then clears the background sync cache. - Adding "plausible" spends to the background sync cache ensures that the wallet does not need to query the daemon to see if any received outputs were spent while background sync was enabled. This would harm privacy especially for users of 3rd party daemons. - To enable the feature in the CLI wallet, the user can set background-sync to reuse-wallet-password or custom-background-password and the wallet automatically syncs in the background when the wallet locks, then processes all background synced txs when the wallet is unlocked. - The custom-background-password option enables the user to open a distinct background wallet that only has a view key saved and can be opened/closed/synced separately from the main wallet. When the main wallet opens, it processes the background wallet's cache. - To enable the feature in the RPC wallet, there is a new `/setup_background_sync` endpoint. - HW, multsig and view-only wallets cannot background sync.
Diffstat (limited to 'src/wallet/api/wallet2_api.h')
-rw-r--r--src/wallet/api/wallet2_api.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
index 71991df0d..e349df176 100644
--- a/src/wallet/api/wallet2_api.h
+++ b/src/wallet/api/wallet2_api.h
@@ -445,6 +445,12 @@ struct Wallet
ConnectionStatus_WrongVersion
};
+ enum BackgroundSyncType {
+ BackgroundSync_Off = 0,
+ BackgroundSync_ReusePassword = 1,
+ BackgroundSync_CustomPassword = 2
+ };
+
virtual ~Wallet() = 0;
virtual std::string seed(const std::string& seed_offset = "") const = 0;
virtual std::string getSeedLanguage() const = 0;
@@ -936,6 +942,42 @@ struct Wallet
*/
virtual bool scanTransactions(const std::vector<std::string> &txids) = 0;
+ /*!
+ * \brief setupBackgroundSync - setup background sync mode with just a view key
+ * \param background_sync_type - the mode the wallet background syncs in
+ * \param wallet_password
+ * \param background_cache_password - custom password to encrypt background cache, only needed for custom password background sync type
+ * \return - true on success
+ */
+ virtual bool setupBackgroundSync(const BackgroundSyncType background_sync_type, const std::string &wallet_password, const optional<std::string> &background_cache_password) = 0;
+
+ /*!
+ * \brief getBackgroundSyncType - get mode the wallet background syncs in
+ * \return - the type, or off if type is unknown
+ */
+ virtual BackgroundSyncType getBackgroundSyncType() const = 0;
+
+ /**
+ * @brief startBackgroundSync - sync the chain in the background with just view key
+ */
+ virtual bool startBackgroundSync() = 0;
+
+ /**
+ * @brief stopBackgroundSync - bring back spend key and process background synced txs
+ * \param wallet_password
+ */
+ virtual bool stopBackgroundSync(const std::string &wallet_password) = 0;
+
+ /**
+ * @brief isBackgroundSyncing - returns true if the wallet is background syncing
+ */
+ virtual bool isBackgroundSyncing() const = 0;
+
+ /**
+ * @brief isBackgroundWallet - returns true if the wallet is a background wallet
+ */
+ virtual bool isBackgroundWallet() const = 0;
+
virtual TransactionHistory * history() = 0;
virtual AddressBook * addressBook() = 0;
virtual Subaddress * subaddress() = 0;