1
0

deprecate wallet.save() and 'eval' command

This commit is contained in:
ecdsa
2013-05-02 10:54:48 +02:00
parent 6be62e44de
commit b2c23f9ac8
4 changed files with 22 additions and 16 deletions

View File

@@ -48,7 +48,6 @@ register_command('deseed', 0, 0, False, True, 'Remove seed from w
register_command('decoderawtransaction', 1, 1, False, True, 'similar to bitcoind\'s command')
register_command('dumpprivkey', 1, 1, True, True, 'Dumps a specified private key for a given address', 'dumpprivkey <bitcoin address>')
register_command('dumpprivkeys', 0, 0, True, True, 'dump all private keys')
register_command('eval', 1, 1, False, True, 'Run python eval() on an object', 'eval <expression>\nExample: eval \"wallet.aliases\"')
register_command('freeze', 1, 1, False, True, 'Freeze the funds at one of your wallet\'s addresses', 'freeze <address>')
register_command('getbalance', 0, 1, False, False, 'Return the balance of your wallet, or of one account in your wallet', 'getbalance [<account>]')
register_command('getaddressbalance', 1, 1, False, False, 'Return the balance of an address', 'getbalance <address>')

View File

@@ -200,7 +200,7 @@ a SimpleConfig instance then reads the wallet file.
def save(self):
def save(self, key=None):
self.save_wallet_config()

View File

@@ -336,7 +336,8 @@ class Wallet:
self.accounts[key][0] = addresses
self.gap_limit = value
self.save()
self.config.set_key('gap_limit', self.gap_limit, True)
self.config.set_key('accounts', self.accounts, True)
return True
else:
return False
@@ -405,6 +406,9 @@ class Wallet:
new = []
for account in self.accounts.keys():
new += self.synchronize_account(account)
if new:
self.config.set_key('accounts', self.accounts, True)
self.config.set_key('addr_history', self.history, True)
return new
@@ -670,11 +674,17 @@ class Wallet:
with self.transaction_lock:
self.transactions[tx_hash] = tx
self.save_transactions()
if self.verifier and tx_height>0:
self.verifier.add(tx_hash, tx_height)
self.update_tx_outputs(tx_hash)
self.save()
def save_transactions(self):
tx = {}
for k,v in self.transactions.items():
tx[k] = str(v)
self.config.set_key('transactions', tx, True)
def receive_history_callback(self, addr, hist):
@@ -684,7 +694,7 @@ class Wallet:
with self.lock:
self.history[addr] = hist
self.save()
self.config.set_key('addr_history', history, True)
if hist != ['*']:
for tx_hash, tx_height in hist:
@@ -893,6 +903,7 @@ class Wallet:
def save(self):
print_error("Warning: wallet.save() is deprecated")
tx = {}
for k,v in self.transactions.items():
tx[k] = str(v)