When using --from_addr:
- change is sent to itself as stated in help text (feature was removed in ThomasV's last commit). - if the wallet is encrypted it doesn't ask for the password.
This commit is contained in:
parent
845143e720
commit
6525189fe0
@ -159,9 +159,17 @@ if __name__ == '__main__':
|
|||||||
interface.update_wallet(wallet)
|
interface.update_wallet(wallet)
|
||||||
wallet.save()
|
wallet.save()
|
||||||
|
|
||||||
|
# check if --from_addr not in wallet (for mktx/payto)
|
||||||
|
is_temporary = False
|
||||||
|
from_addr = None
|
||||||
|
if options.from_addr:
|
||||||
|
from_addr = options.from_addr
|
||||||
|
if from_addr not in wallet.all_addresses():
|
||||||
|
is_temporary = True
|
||||||
|
|
||||||
# commands needing password
|
# commands needing password
|
||||||
if cmd in ['payto', 'password', 'mktx', 'seed', 'import','signmessage' ] or ( cmd=='addresses' and options.show_keys):
|
if cmd in ['payto', 'password', 'mktx', 'seed', 'import','signmessage' ] or ( cmd=='addresses' and options.show_keys):
|
||||||
password = getpass.getpass('Password:') if wallet.use_encryption else None
|
password = getpass.getpass('Password:') if wallet.use_encryption and not is_temporary else None
|
||||||
# check password
|
# check password
|
||||||
try:
|
try:
|
||||||
wallet.pw_decode( wallet.seed, password)
|
wallet.pw_decode( wallet.seed, password)
|
||||||
@ -303,23 +311,18 @@ if __name__ == '__main__':
|
|||||||
wallet.save()
|
wallet.save()
|
||||||
|
|
||||||
elif cmd in ['payto', 'mktx']:
|
elif cmd in ['payto', 'mktx']:
|
||||||
is_temporary = False
|
if from_addr and is_temporary:
|
||||||
if options.from_addr:
|
if from_addr.find(":") == -1:
|
||||||
from_addr = options.from_addr
|
keypair = from_addr + ":" + getpass.getpass('Private key:')
|
||||||
if from_addr not in wallet.all_addresses():
|
else:
|
||||||
if from_addr.find(":") == -1:
|
keypair = from_addr
|
||||||
keypair = from_addr + ":" + getpass.getpass('Private key:')
|
from_addr = keypair.split(':')[0]
|
||||||
else:
|
if not wallet.import_key(keypair,password):
|
||||||
keypair = from_addr
|
print "invalid key pair"
|
||||||
from_addr = keypair.split(':')[0]
|
exit(1)
|
||||||
if not wallet.import_key(keypair,password):
|
wallet.history[from_addr] = interface.retrieve_history(from_addr)
|
||||||
print "invalid key pair"
|
wallet.update_tx_history()
|
||||||
exit(1)
|
change_addr = from_addr
|
||||||
wallet.history[from_addr] = interface.retrieve_history(from_addr)
|
|
||||||
wallet.update_tx_history()
|
|
||||||
is_temporary = True
|
|
||||||
else:
|
|
||||||
from_addr = None
|
|
||||||
|
|
||||||
if options.change_addr:
|
if options.change_addr:
|
||||||
change_addr = options.change_addr
|
change_addr = options.change_addr
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user