mirror of
https://github.com/monero-project/monero.git
synced 2025-05-02 19:04:55 -04:00
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.
This commit is contained in:
parent
cc73fe7116
commit
e71c8bf190
20 changed files with 2340 additions and 132 deletions
|
@ -1139,3 +1139,45 @@ class Wallet(object):
|
|||
'id': '0'
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(frozen)
|
||||
|
||||
class BackgroundSyncOptions(object):
|
||||
def __init__(self):
|
||||
self.off = 'off'
|
||||
self.reuse_password = 'reuse-wallet-password'
|
||||
self.custom_password = 'custom-background-password'
|
||||
background_sync_options = BackgroundSyncOptions()
|
||||
|
||||
def setup_background_sync(self, background_sync_type = background_sync_options.off, wallet_password = '', background_cache_password = ''):
|
||||
setup_background_sync = {
|
||||
'method': 'setup_background_sync',
|
||||
'jsonrpc': '2.0',
|
||||
'params' : {
|
||||
'background_sync_type': background_sync_type,
|
||||
'wallet_password': wallet_password,
|
||||
'background_cache_password': background_cache_password,
|
||||
},
|
||||
'id': '0'
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(setup_background_sync)
|
||||
|
||||
def start_background_sync(self):
|
||||
start_background_sync = {
|
||||
'method': 'start_background_sync',
|
||||
'jsonrpc': '2.0',
|
||||
'params' : {},
|
||||
'id': '0'
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(start_background_sync)
|
||||
|
||||
def stop_background_sync(self, wallet_password = '', seed = '', seed_offset = ''):
|
||||
stop_background_sync = {
|
||||
'method': 'stop_background_sync',
|
||||
'jsonrpc': '2.0',
|
||||
'params' : {
|
||||
'wallet_password': wallet_password,
|
||||
'seed': seed,
|
||||
'seed_offset': seed_offset,
|
||||
},
|
||||
'id': '0'
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(stop_background_sync)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue