mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-05-31 00:01:56 +08:00
Merge branch 'portal-fix-withdraw' into rc-0.14.2
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user