Merge remote-tracking branch 'origin/rc-0.14.2-portal' into rc-0.14.2

This commit is contained in:
Jude Nelson
2017-06-16 18:43:40 -04:00
3 changed files with 15 additions and 8 deletions

View File

@@ -32,7 +32,7 @@ parent_dir = os.path.abspath(current_dir + "/../")
from ..constants import TX_EXPIRED_INTERVAL, TX_CONFIRMATIONS_NEEDED, TX_MIN_CONFIRMATIONS
from ..constants import MAXIMUM_NAMES_PER_ADDRESS
from ..constants import BLOCKSTACK_TEST, BLOCKSTACK_DRY_RUN
from ..constants import CONFIG_PATH
from ..constants import CONFIG_PATH, BLOCKSTACK_DEBUG
from ..logger import get_logger

View File

@@ -116,9 +116,6 @@ def estimate_input_length( privkey_info ):
Estimate the length of a missing input
of a transaction
"""
assert address
address = str(address)
if virtualchain.is_singlesig(privkey_info):
return APPROX_TX_OVERHEAD_LEN + APPROX_TX_IN_P2PKH_LEN
@@ -381,7 +378,7 @@ def estimate_register_tx_fee( name, payment_privkey_info, owner_privkey_info, tx
except AssertionError as e:
# no UTXOs for this owner address. Try again and add padding for one
unsigned_tx = register_tx( name, payment_addr, owner_addr, utxo_client, subsidized=True, safety=False )
unsigned_tx = register_tx( name, payment_addr, owner_addr, utxo_client, subsidize=True, safety=False )
assert unsigned_tx
pad_len = estimate_input_length(payment_privkey_info)
@@ -453,7 +450,7 @@ def estimate_renewal_tx_fee( name, renewal_fee, payment_privkey_info, owner_priv
except AssertionError as ae:
# no UTXOs for this owner address. Try again and add padding for one
unsigned_tx = register_tx( name, owner_address, owner_address, utxo_client, renewal_fee=renewal_fee, subsidized=True, safety=False )
unsigned_tx = register_tx( name, owner_address, owner_address, utxo_client, renewal_fee=renewal_fee, subsidize=True, safety=False )
assert unsigned_tx
pad_len = estimate_input_length(payment_privkey_info) + estimate_input_length(owner_privkey_info)

View File

@@ -578,9 +578,19 @@ def get_operation_fees(name_or_ns, operations, scatter_gather, payment_privkey_i
balance = sum([utxo.get('value', None) for utxo in payment_utxos])
log.debug("Balance of {} is {} satoshis".format(payment_address, balance))
estimated_owner_inputs = []
estiamted_payment_inputs = []
# find out what our UTXOs will look like for each operation
estimated_payment_inputs = estimate_transaction_inputs(operations, payment_utxos, payment_address=payment_address)['inputs']
estimated_owner_inputs = estimate_transaction_inputs(operations, owner_utxos, owner_address=owner_address)['inputs']
if len(owner_utxos) > 0:
estimated_owner_inputs = estimate_transaction_inputs(operations, owner_utxos, owner_address=owner_address)['inputs']
else:
estimated_owner_inputs = [[]] * len(operations)
if len(payment_utxos) > 0:
estimated_payment_inputs = estimate_transaction_inputs(operations, payment_utxos, payment_address=payment_address)['inputs']
else:
estimated_payment_inputs = [[]] * len(operations)
log.debug("Get total operation fees for running '{}' on {} owned by {} paid by {}".format(','.join(operations), name_or_ns, owner_address, payment_address))