Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Verify TX requested to sign is as expected
tx_is_correct, err_msg = verify_unsigned_tx(
unsigned_tx=unsigned_tx,
outputs=outputs,
sweep_funds=sweep_funds,
change_address=change_address,
coin_symbol=coin_symbol,
)
if not tx_is_correct:
puts(colored.red('TX Error: Tx NOT Signed or Broadcast'))
puts(colored.red(err_msg))
# Abandon
return
input_addresses = get_input_addresses(unsigned_tx)
verbose_print('input_addresses')
verbose_print(input_addresses)
address_paths = [{'path': x['hd_path'], 'address': x['addresses'][0]} for x in unsigned_tx['tx']['inputs']]
# be sure all addresses returned
address_paths_filled = verify_and_fill_address_paths_from_bip32key(
address_paths=address_paths,
master_key=mpriv,
network=guess_network_from_mkey(mpriv),
)
verbose_print('adress_paths_filled:')
verbose_print(address_paths_filled)
hexkeypair_dict = hexkeypair_list_to_dict(address_paths_filled)
# Verify TX requested to sign is as expected
tx_is_correct, err_msg = verify_unsigned_tx(
unsigned_tx=unsigned_tx,
outputs=outputs,
sweep_funds=sweep_funds,
change_address=change_address,
coin_symbol=coin_symbol,
)
if not tx_is_correct:
puts(colored.red('TX Error: Tx NOT Signed or Broadcast'))
puts(colored.red(err_msg))
# Abandon
return
input_addresses = get_input_addresses(unsigned_tx)
verbose_print('input_addresses')
verbose_print(input_addresses)
address_paths = [{'path': x['hd_path'], 'address': x['addresses'][0]} for x in unsigned_tx['tx']['inputs']]
# be sure all addresses returned
address_paths_filled = verify_and_fill_address_paths_from_bip32key(
address_paths=address_paths,
master_key=mpriv,
network=guess_network_from_mkey(mpriv),
)
verbose_print('adress_paths_filled:')
verbose_print(address_paths_filled)
hexkeypair_dict = hexkeypair_list_to_dict(address_paths_filled)