diff --git a/blockstack_client/actions.py b/blockstack_client/actions.py index bc7293694..99032f6d6 100644 --- a/blockstack_client/actions.py +++ b/blockstack_client/actions.py @@ -477,6 +477,7 @@ def cli_withdraw(args, password=None, interactive=True, wallet_keys=None, config change = 0 if amt is None: # total transfer, minus tx fee + log.debug("No amount given; assuming all ({})".format(total_value - tx_fee)) amt = total_value - tx_fee if amt < 0: log.error("Dust: total value = {}, tx fee = {}".format(total_value, tx_fee)) @@ -484,6 +485,7 @@ def cli_withdraw(args, password=None, interactive=True, wallet_keys=None, config else: change = virtualchain.calculate_change_amount(inputs, amt, tx_fee) + log.debug("Withdraw {}, tx fee {}".format(amt, tx_fee)) outputs = [ {'script': virtualchain.make_payment_script(recipient_addr), @@ -515,6 +517,8 @@ def cli_withdraw(args, password=None, interactive=True, wallet_keys=None, config log.debug("Withdraw {} from {} to {}".format(amount, send_addr, recipient_addr)) + log.debug("Withdraw {} from {} to {}".format(amount, send_addr, recipient_addr)) + res = broadcast_tx( tx, config_path=config_path ) if 'error' in res: res['errno'] = errno.EIO diff --git a/integration_tests/blockstack_integration_tests/scenarios/rest_noauth_withdraw.py b/integration_tests/blockstack_integration_tests/scenarios/rest_noauth_withdraw.py index 87ee7482b..a7582fb84 100644 --- a/integration_tests/blockstack_integration_tests/scenarios/rest_noauth_withdraw.py +++ b/integration_tests/blockstack_integration_tests/scenarios/rest_noauth_withdraw.py @@ -138,18 +138,23 @@ def scenario( wallets, **kw ): print "\n\nTransaction: {}\n\n".format(res['response']['transaction_hash']) # confirm it - for i in xrange(0, 10): + for i in xrange(0, 12): testlib.next_block(**kw) new_balance = testlib.get_balance(wallets[5].addr) balance_after = testlib.get_balance(wallets[8].addr) + print "wallet balance: {}".format(wallet_balance) + print "new balance {}: {}".format(wallets[5].addr, new_balance) + print "balance after {}: {}".format(wallets[8].addr, balance_after) + print "balance before {}: {}".format(wallets[8].addr, balance_before) + if new_balance > wallet_balance / 2: print 'new balance of {} is {}'.format(wallets[5].addr, new_balance) return False - if abs(balance_before + wallet_balance - balance_after) > 10000: - print "{} + {} != {}".format(balance_before, wallet_balance, balance_after) + if abs(balance_after - balance_before) > abs(wallet_balance / 2) + 54500: + print "{} - {} != {}".format(balance_after, balance_before, wallet_balance / 2) return False diff --git a/integration_tests/blockstack_integration_tests/scenarios/testlib.py b/integration_tests/blockstack_integration_tests/scenarios/testlib.py index da4e71548..8d9928b21 100644 --- a/integration_tests/blockstack_integration_tests/scenarios/testlib.py +++ b/integration_tests/blockstack_integration_tests/scenarios/testlib.py @@ -2444,6 +2444,7 @@ def get_balance( addr ): Get the address balance """ inputs = blockstack_client.backend.blockchain.get_utxos(addr) + log.debug("UTXOS of {} are {}".format(addr, inputs)) return sum([inp['value'] for inp in inputs])