Move get_dict method from wallet_db to json_db.
Define overloaded methods: _convert_dict _convert_values
This commit is contained in:
@@ -167,6 +167,20 @@ class JsonDB(Logger):
|
||||
return True
|
||||
return False
|
||||
|
||||
@locked
|
||||
def get_dict(self, name) -> dict:
|
||||
# Warning: interacts un-intuitively with 'put': certain parts
|
||||
# of 'data' will have pointers saved as separate variables.
|
||||
if name not in self.data:
|
||||
self.data[name] = {}
|
||||
return self.data[name]
|
||||
|
||||
def _convert_dict(self, path, key, v):
|
||||
return v
|
||||
|
||||
def _convert_value(self, path, key, v):
|
||||
return v
|
||||
|
||||
@locked
|
||||
def dump(self, *, human_readable: bool = True) -> str:
|
||||
"""Serializes the DB as a string.
|
||||
|
||||
@@ -1337,14 +1337,6 @@ class WalletDB(JsonDB):
|
||||
assert isinstance(txid, str)
|
||||
self.tx_fees.pop(txid, None)
|
||||
|
||||
@locked
|
||||
def get_dict(self, name) -> dict:
|
||||
# Warning: interacts un-intuitively with 'put': certain parts
|
||||
# of 'data' will have pointers saved as separate variables.
|
||||
if name not in self.data:
|
||||
self.data[name] = {}
|
||||
return self.data[name]
|
||||
|
||||
@locked
|
||||
def num_change_addresses(self) -> int:
|
||||
return len(self.change_addresses)
|
||||
|
||||
Reference in New Issue
Block a user