mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-13 22:38:00 +08:00
document where we expect name costs to be burned and paid, and account for new tx fee calculation
This commit is contained in:
@@ -77,7 +77,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw ) # expired
|
||||
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) # +name_cost
|
||||
if 'error' in res:
|
||||
print res
|
||||
return False
|
||||
@@ -95,7 +95,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw ) # expired
|
||||
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[3].privkey, wallets[4].addr )
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[3].privkey, wallets[4].addr ) # +name_cost
|
||||
if 'error' in res:
|
||||
print res
|
||||
return False
|
||||
@@ -110,7 +110,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
res = testlib.blockstack_name_renew("foo.test", wallets[4].privkey)
|
||||
res = testlib.blockstack_name_renew("foo.test", wallets[4].privkey) # +name_cost
|
||||
if 'error' in res:
|
||||
print res
|
||||
return False
|
||||
@@ -121,7 +121,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw ) # expired
|
||||
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) # +name_cost
|
||||
if 'error' in res:
|
||||
print res
|
||||
return False
|
||||
@@ -140,7 +140,7 @@ def scenario( wallets, **kw ):
|
||||
name_cost = name_rec['op_fee']
|
||||
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw ) # stop fee collection
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw ) # expired
|
||||
|
||||
@@ -150,18 +150,18 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
# preorder should send to the null burn address now.
|
||||
res = testlib.blockstack_name_preorder( "foo2.test", wallets[4].privkey, wallets[0].addr )
|
||||
res = testlib.blockstack_name_preorder( "foo2.test", wallets[4].privkey, wallets[0].addr ) # does not pay to namespace
|
||||
if 'error' in res:
|
||||
print res
|
||||
return False
|
||||
|
||||
# try forcing it to the namespace burn address, to verify that it fails
|
||||
res = testlib.blockstack_name_preorder( "foo_fail.test", wallets[4].privkey, wallets[0].addr, burn_addr=namespace_rec['address'], expect_fail=True )
|
||||
res = testlib.blockstack_name_preorder( "foo_fail.test", wallets[4].privkey, wallets[0].addr, burn_addr=namespace_rec['address'], expect_fail=True ) # does not pay to namespace (command fails)
|
||||
if 'error' not in res:
|
||||
print res
|
||||
return False
|
||||
|
||||
res = testlib.blockstack_name_preorder( "foo_fail.test", wallets[4].privkey, wallets[0].addr, burn_addr=namespace_rec['address'], safety_checks=False, tx_fee=10000*5 )
|
||||
res = testlib.blockstack_name_preorder( "foo_fail.test", wallets[4].privkey, wallets[0].addr, burn_addr=namespace_rec['address'], price={'units': 'BTC', 'amount': name_cost}, safety_checks=False, tx_fee=10000*5 ) # +name_cost
|
||||
if 'error' in res:
|
||||
print res
|
||||
return False
|
||||
@@ -196,9 +196,9 @@ def scenario( wallets, **kw ):
|
||||
name_cost_2 = name_rec_2['op_fee']
|
||||
|
||||
# namespace should NOT have gotten the fee for foo_fail. It should only have gotten it for foo.test
|
||||
if new_namespace_balance - namespace_balance != 4*name_cost + 11250:
|
||||
if new_namespace_balance - namespace_balance < 5*name_cost or new_namespace_balance - namespace_balance > 6*name_cost:
|
||||
print 'address {} got credited after fee capture period'.format(namespace_rec['address'])
|
||||
print '{} != {} + 4*{}'.format(new_namespace_balance, namespace_balance, name_cost)
|
||||
print '{} != {} + 5*{}'.format(new_namespace_balance, namespace_balance, name_cost)
|
||||
return False
|
||||
|
||||
# burn address should have received the fee for the second name
|
||||
|
||||
@@ -65,7 +65,7 @@ def scenario( wallets, **kw ):
|
||||
namespace_balance = testlib.get_balance(namespace_rec['address'])
|
||||
burn_balance = testlib.get_balance(blockstack.lib.config.BLOCKSTACK_BURN_ADDRESS)
|
||||
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) # +name_cost
|
||||
if 'error' in res:
|
||||
print res
|
||||
return False
|
||||
@@ -83,7 +83,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw ) # expired
|
||||
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[3].privkey, wallets[4].addr )
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[3].privkey, wallets[4].addr ) # +name_cost
|
||||
if 'error' in res:
|
||||
print res
|
||||
return False
|
||||
@@ -98,7 +98,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
res = testlib.blockstack_name_renew("foo.test", wallets[4].privkey)
|
||||
res = testlib.blockstack_name_renew("foo.test", wallets[4].privkey) # +name_cost
|
||||
if 'error' in res:
|
||||
print res
|
||||
return False
|
||||
@@ -109,7 +109,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw ) # expired
|
||||
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) # +name_cost
|
||||
if 'error' in res:
|
||||
print res
|
||||
return False
|
||||
@@ -138,7 +138,7 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
# preorder should send to the null burn address now.
|
||||
res = testlib.blockstack_name_preorder( "foo2.test", wallets[4].privkey, wallets[0].addr )
|
||||
res = testlib.blockstack_name_preorder( "foo2.test", wallets[4].privkey, wallets[0].addr ) # does not pay to namespace
|
||||
if 'error' in res:
|
||||
print res
|
||||
return False
|
||||
@@ -149,7 +149,7 @@ def scenario( wallets, **kw ):
|
||||
print res
|
||||
return False
|
||||
|
||||
res = testlib.blockstack_name_preorder( "foo_fail.test", wallets[4].privkey, wallets[0].addr, burn_addr=namespace_rec['address'], safety_checks=False, tx_fee=10000*5 )
|
||||
res = testlib.blockstack_name_preorder( "foo_fail.test", wallets[4].privkey, wallets[0].addr, burn_addr=namespace_rec['address'], price={'units': 'BTC', 'amount': name_cost}, safety_checks=False, tx_fee=10000*5 ) # +name_cost
|
||||
if 'error' in res:
|
||||
print res
|
||||
return False
|
||||
@@ -183,9 +183,9 @@ def scenario( wallets, **kw ):
|
||||
name_cost_2 = name_rec_2['op_fee']
|
||||
|
||||
# namespace should NOT have gotten the fee for foo_fail. It should only have gotten it for foo.test
|
||||
if new_namespace_balance - namespace_balance != 4*name_cost + 11250:
|
||||
if new_namespace_balance - namespace_balance < 5*name_cost or new_namespace_balance - namespace_balance > 6*name_cost:
|
||||
print 'address {} got credited after fee capture period'.format(namespace_rec['address'])
|
||||
print '{} != {} + 4*{}'.format(new_namespace_balance, namespace_balance, name_cost)
|
||||
print '{} != {} + 5*{}'.format(new_namespace_balance, namespace_balance, name_cost)
|
||||
return False
|
||||
|
||||
# burn address should have received the fee for the second name
|
||||
|
||||
@@ -64,7 +64,7 @@ def scenario( wallets, **kw ):
|
||||
namespace_balance = testlib.get_balance(namespace_rec['address'])
|
||||
burn_balance = testlib.get_balance(blockstack.lib.config.BLOCKSTACK_BURN_ADDRESS)
|
||||
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) # +name_cost
|
||||
if 'error' in res:
|
||||
print res
|
||||
return False
|
||||
@@ -100,7 +100,7 @@ def scenario( wallets, **kw ):
|
||||
print res
|
||||
return False
|
||||
|
||||
res = testlib.blockstack_name_preorder( "foo_fail.test", wallets[2].privkey, wallets[3].addr, burn_addr=namespace_rec['address'], safety_checks=False, tx_fee=10000*5 )
|
||||
res = testlib.blockstack_name_preorder( "foo_fail.test", wallets[2].privkey, wallets[3].addr, burn_addr=namespace_rec['address'], price={'units': 'BTC', 'amount': name_cost}, safety_checks=False, tx_fee=10000*5 ) # +name_cost
|
||||
if 'error' in res:
|
||||
print res
|
||||
return False
|
||||
@@ -134,9 +134,9 @@ def scenario( wallets, **kw ):
|
||||
name_cost_2 = name_rec_2['op_fee']
|
||||
|
||||
# namespace should NOT have gotten the fee for foo_fail. It should only have gotten it for foo.test
|
||||
if new_namespace_balance - namespace_balance != name_cost + 250:
|
||||
if new_namespace_balance - namespace_balance < 2*name_cost or new_namespace_balance - namespace_balance >= 3*name_cost:
|
||||
print 'address {} got credited after fee capture period'.format(namespace_rec['address'])
|
||||
print '{} != {} + {}'.format(new_namespace_balance, namespace_balance, name_cost)
|
||||
print '{} != {} + 2*{}'.format(new_namespace_balance, namespace_balance, name_cost)
|
||||
return False
|
||||
|
||||
# burn address should have received the fee for the second name
|
||||
|
||||
Reference in New Issue
Block a user