Make wallet settings processing pass without recipient set

This commit is contained in:
lash 2022-05-14 12:23:49 +00:00
parent 3f24ab93fc
commit dfe18a4238
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746

View File

@ -62,22 +62,26 @@ def process_settings_wallet(settings, config):
wallet = chainlib.eth.cli.Wallet() wallet = chainlib.eth.cli.Wallet()
wallet.from_config(config) wallet.from_config(config)
settings.set('WALLET', wallet)
recipient_in = None recipient_in = None
try: try:
recipient_in = config.get('_RECIPIENT') recipient_in = config.get('_RECIPIENT')
except KeyError: except KeyError:
return settings return settings
if recipient_in == None:
return settings
if wallet.get_signer_address() == None and recipient_in != None: if wallet.get_signer_address() == None and recipient_in != None:
recipient_in = wallet.from_address(recipient_in) recipient_in = wallet.from_address(recipient_in)
recipient_in = strip_0x(recipient_in)
recipient_in = strip_0x(recipient_in)
recipient = to_checksum_address(recipient_in) recipient = to_checksum_address(recipient_in)
if not config.true('_UNSAFE') and recipient != recipient_in: if not config.true('_UNSAFE') and recipient != recipient_in:
raise ValueError('invalid checksum address: {}'.format(recipient_in)) raise ValueError('invalid checksum address: {}'.format(recipient_in))
recipient = add_0x(recipient) recipient = add_0x(recipient)
settings.set('WALLET', wallet)
settings.set('RECIPIENT', recipient) settings.set('RECIPIENT', recipient)
return settings return settings