mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-23 19:31:00 +08:00
demo.id; test bigger withdraw samples
This commit is contained in:
@@ -54,10 +54,10 @@ def scenario( wallets, **kw ):
|
||||
testlib.blockstack_namespace_ready( "id", wallets[1].privkey )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
testlib.blockstack_name_preorder( "foo.id", wallets[2].privkey, wallets[3].addr )
|
||||
testlib.blockstack_name_preorder( "demo.id", wallets[2].privkey, wallets[3].addr )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
testlib.blockstack_name_register( "foo.id", wallets[2].privkey, wallets[3].addr )
|
||||
testlib.blockstack_name_register( "demo.id", wallets[2].privkey, wallets[3].addr )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
|
||||
@@ -80,13 +80,13 @@ def check( state_engine ):
|
||||
return False
|
||||
|
||||
# not preordered
|
||||
preorder = state_engine.get_name_preorder( "foo.id", pybitcoin.make_pay_to_address_script(wallets[2].addr), wallets[3].addr )
|
||||
preorder = state_engine.get_name_preorder( "demo.id", pybitcoin.make_pay_to_address_script(wallets[2].addr), wallets[3].addr )
|
||||
if preorder is not None:
|
||||
print "preorder exists"
|
||||
return False
|
||||
|
||||
# registered
|
||||
name_rec = state_engine.get_name( "foo.id" )
|
||||
name_rec = state_engine.get_name( "demo.id" )
|
||||
if name_rec is None:
|
||||
print "name does not exist"
|
||||
return False
|
||||
|
||||
@@ -124,7 +124,7 @@ def scenario( wallets, **kw ):
|
||||
balance_before = testlib.get_balance(wallets[8].addr)
|
||||
|
||||
# can we move the funds?
|
||||
res = testlib.blockstack_REST_call('POST', '/v1/wallet/balance', None, api_pass=api_pass, data={'address': wallets[8].addr, 'amount': wallet_balance - 10000, 'message': "hello world!"})
|
||||
res = testlib.blockstack_REST_call('POST', '/v1/wallet/balance', None, api_pass=api_pass, data={'address': wallets[8].addr, 'amount': wallet_balance / 2, 'message': "hello world!"})
|
||||
if res['http_status'] != 200:
|
||||
res['test'] = 'failed to transfer funds'
|
||||
print json.dumps(res)
|
||||
@@ -144,7 +144,7 @@ def scenario( wallets, **kw ):
|
||||
new_balance = testlib.get_balance(wallets[5].addr)
|
||||
balance_after = testlib.get_balance(wallets[8].addr)
|
||||
|
||||
if new_balance > 10000:
|
||||
if new_balance > wallet_balance / 2:
|
||||
print 'new balance of {} is {}'.format(wallets[5].addr, new_balance)
|
||||
return False
|
||||
|
||||
|
||||
@@ -2373,6 +2373,26 @@ def start_api(password):
|
||||
|
||||
return {'status': True}
|
||||
|
||||
|
||||
def stop_api():
|
||||
"""
|
||||
Stop API server
|
||||
"""
|
||||
config_path = os.environ.get("BLOCKSTACK_CLIENT_CONFIG")
|
||||
assert config_path is not None
|
||||
|
||||
config_dir = os.path.dirname(config_path)
|
||||
|
||||
conf = blockstack_client.get_config(config_path)
|
||||
port = int(conf['api_endpoint_port'])
|
||||
api_pass = conf['api_password']
|
||||
|
||||
res = blockstack_client.rpc.local_api_stop(config_dir=config_dir)
|
||||
if not res:
|
||||
return {'error': 'Failed to stop API server'}
|
||||
|
||||
return {'status': True}
|
||||
|
||||
|
||||
def instantiate_wallet():
|
||||
"""
|
||||
@@ -2944,6 +2964,7 @@ def migrate_profile( name, proxy=None, wallet_keys=None, zonefile_has_data_key=T
|
||||
|
||||
user_profile = None
|
||||
user_zonefile = None
|
||||
user_zonefile_txt = None
|
||||
|
||||
res = blockstack_cli_lookup(name, config_path=config_path)
|
||||
if 'error' in res:
|
||||
@@ -2961,6 +2982,8 @@ def migrate_profile( name, proxy=None, wallet_keys=None, zonefile_has_data_key=T
|
||||
log.debug("Will not set zone file public key")
|
||||
user_zonefile = blockstack_client.zonefile.make_empty_zonefile(name, None)
|
||||
|
||||
user_zonefile_txt = blockstack_zones.make_zone_file(user_zonefile)
|
||||
|
||||
else:
|
||||
user_profile = res['profile']
|
||||
user_zonefile_txt = res['zonefile']
|
||||
@@ -3024,6 +3047,7 @@ def migrate_profile( name, proxy=None, wallet_keys=None, zonefile_has_data_key=T
|
||||
'zonefile_hash': user_zonefile_hash,
|
||||
'transaction_hash': res['transaction_hash'],
|
||||
'zonefile': user_zonefile,
|
||||
'zonefile_txt': user_zonefile_txt,
|
||||
'profile': user_profile
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user