本文整理汇总了Python中testlib.blockstore_name_update函数的典型用法代码示例。如果您正苦于以下问题:Python blockstore_name_update函数的具体用法?Python blockstore_name_update怎么用?Python blockstore_name_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了blockstore_name_update函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: scenario
def scenario( wallets, **kw ):
testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstore_namespace_ready( "test", wallets[1].privkey )
testlib.next_block( **kw )
testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr )
testlib.next_block( **kw )
testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
testlib.next_block( **kw )
testlib.blockstore_name_update( "foo.test", "11" * 20, wallets[3].privkey )
testlib.next_block( **kw )
consensus_hash = testlib.get_consensus_at( testlib.get_current_block( **kw ), **kw )
# lots of blocks later...
for i in xrange(0, 50):
testlib.next_block( **kw )
# update with stale consensus hash (should fail)
testlib.blockstore_name_update( "foo.test", "22" * 20, wallets[3].privkey, consensus_hash=consensus_hash )
testlib.next_block( **kw )
示例2: scenario
def scenario( wallets, **kw ):
global snv_consensus, snv_block_id, last_consensus, last_block_id
testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstore_namespace_ready( "test", wallets[1].privkey )
testlib.next_block( **kw )
testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr )
testlib.next_block( **kw )
testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
testlib.next_block( **kw )
snv_block_id = testlib.get_current_block()
snv_consensus = testlib.get_consensus_at( snv_block_id )
testlib.blockstore_name_update( "foo.test", "11" * 20, wallets[3].privkey )
testlib.next_block( **kw )
last_block_id = testlib.get_current_block()
last_consensus = testlib.get_consensus_at( last_block_id )
示例3: scenario
def scenario( wallets, **kw ):
testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstore_namespace_ready( "test", wallets[1].privkey )
testlib.next_block( **kw )
testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr )
testlib.next_block( **kw )
testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
testlib.next_block( **kw )
testlib.blockstore_name_update( "foo.test", "11" * 20, wallets[3].privkey )
testlib.next_block( **kw )
# should fail--can't give a name to yourself
testlib.blockstore_name_transfer( "foo.test", wallets[4].addr, True, wallets[4].privkey )
testlib.next_block( **kw )
# should fail--can't steal a name
testlib.blockstore_name_transfer( "foo.test", wallets[4].addr, True, wallets[0].privkey )
testlib.next_block( **kw )
示例4: scenario
def scenario( wallets, **kw ):
testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 1, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstore_namespace_ready( "test", wallets[1].privkey )
testlib.next_block( **kw )
# preorder, register, update, expire (multiple times)
for i in xrange(2, 11):
resp = testlib.blockstore_name_preorder( "foo.test", wallets[i].privkey, wallets[(i+1)%11].addr )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_name_register( "foo.test", wallets[i].privkey, wallets[(i+1)%11].addr )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_name_update( "foo.test", ("%02x" % i) * 20, wallets[(i+1)%11].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
if i == 10:
break
testlib.next_block( **kw )
示例5: scenario
def scenario( wallets, **kw ):
global txids
global consensuses
testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstore_namespace_ready( "test", wallets[1].privkey )
testlib.next_block( **kw )
testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr )
testlib.next_block( **kw )
testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
testlib.next_block( **kw )
testlib.next_block( **kw )
# do a sequence of updates, every other block
for i in xrange( 0, 20 ):
if (i % 2) != 0:
update_hash = ("%02x" % (i)) * 20
resp = testlib.blockstore_name_update( "foo.test", update_hash, wallets[3].privkey )
txids[ update_hash ] = resp['transaction_hash']
consensuses[ update_hash ] = testlib.get_consensus_at( testlib.get_current_block( **kw ), **kw )
testlib.next_block( **kw )
testlib.next_block( **kw )
示例6: do_interleaving
def do_interleaving( name, namerecs, order ):
# order should be a string of "u", "t", and "r"
order = list(order)
for i in xrange(0, len(order)):
op = order[i]
if op == 'r':
# renew
print "\nrenew '%s' with %s\n" % (name, pybitcoin.make_pay_to_address_script( namerecs[name][0].addr ))
resp = testlib.blockstore_name_renew( name, namerecs[name][0].privkey, register_addr=namerecs[name][0].addr )
if 'error' in resp:
print json.dumps( resp, indent=4 )
elif op == 'u':
# update
resp = testlib.blockstore_name_update( name, ("%s%s" % (i, i)) * 20, namerecs[name][0].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
elif op == 't':
# transfer and exchange wallets
print "\ntransfer '%s' from %s to %s" % (name, pybitcoin.make_pay_to_address_script( namerecs[name][0].addr ), pybitcoin.make_pay_to_address_script( namerecs[name][1].addr ))
resp = testlib.blockstore_name_transfer( name, namerecs[name][1].addr, True, namerecs[name][0].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
tmp = namerecs[name][0]
namerecs[name][0] = namerecs[name][1]
namerecs[name][1] = tmp
开发者ID:reddink,项目名称:blockstore,代码行数:32,代码来源:name_preorder_register_update_transfer_renew_interleaving.py
示例7: scenario
def scenario( wallets, **kw ):
global snv_block_id_foo, snv_txid_bar, snv_txid_baz, last_consensus
# make a test namespace
resp = testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_name_import( "foo.test", wallets[3].addr, "11" * 20, wallets[1].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
snv_block_id_foo = testlib.get_current_block()
resp = testlib.blockstore_name_import( "bar.test", wallets[5].addr, "33" * 20, wallets[1].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_name_import( "baz.test", wallets[6].addr, "33" * 20, wallets[1].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_namespace_ready( "test", wallets[1].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_name_transfer( "bar.test", wallets[4].addr, True, wallets[5].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
snv_txid_bar = resp['transaction_hash']
testlib.next_block( **kw )
resp = testlib.blockstore_name_update( "baz.test", "22" * 20, wallets[6].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
last_consensus = testlib.get_consensus_at( testlib.get_current_block() )
示例8: scenario
def scenario( wallets, **kw ):
testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstore_namespace_ready( "test", wallets[1].privkey )
testlib.next_block( **kw )
testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr )
testlib.next_block( **kw )
testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
testlib.next_block( **kw )
testlib.blockstore_name_update( "foo.test", "11" * 20, wallets[3].privkey )
testlib.next_block( **kw )
示例9: scenario
def scenario(wallets, **kw):
global debug
resp = testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey)
if debug or "error" in resp:
print json.dumps(resp, indent=4)
testlib.next_block(**kw)
resp = testlib.blockstore_namespace_reveal(
"test",
wallets[1].addr,
52595,
250,
4,
[6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
10,
10,
wallets[0].privkey,
)
if debug or "error" in resp:
print json.dumps(resp, indent=4)
testlib.next_block(**kw)
resp = testlib.blockstore_namespace_ready("test", wallets[1].privkey)
if debug or "error" in resp:
print json.dumps(resp, indent=4)
testlib.next_block(**kw)
resp = testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr)
if debug or "error" in resp:
print json.dumps(resp, indent=4)
testlib.next_block(**kw)
resp = testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr)
if debug or "error" in resp:
print json.dumps(resp, indent=4)
testlib.next_block(**kw)
resp = testlib.blockstore_name_update("foo.test", "11" * 20, wallets[3].privkey)
if debug or "error" in resp:
print json.dumps(resp, indent=4)
testlib.next_block(**kw)
resp = testlib.blockstore_name_transfer("foo.test", wallets[4].addr, True, wallets[3].privkey)
if debug or "error" in resp:
print json.dumps(resp, indent=4)
testlib.next_block(**kw)
示例10: scenario
def scenario( wallets, **kw ):
testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstore_namespace_ready( "test", wallets[1].privkey )
testlib.next_block( **kw )
resp = testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr )
if 'error' in resp:
print json.dumps(resp)
testlib.next_block( **kw )
# no name operations should work on this name, except register
resp = testlib.blockstore_name_update( "foo.test", "11" * 20, wallets[3].privkey )
if 'error' in resp:
print json.dumps(resp)
testlib.next_block( **kw )
resp = testlib.blockstore_name_renew( "foo.test", wallets[3].privkey )
if 'error' in resp:
print json.dumps(resp)
testlib.next_block( **kw )
resp = testlib.blockstore_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey )
if 'error' in resp:
print json.dumps(resp)
testlib.next_block( **kw )
# try both addresses (should both fail)
resp = testlib.blockstore_name_revoke( "foo.test", wallets[4].privkey )
if 'error' in resp:
print json.dumps(resp)
testlib.next_block( **kw )
resp = testlib.blockstore_name_revoke( "foo.test", wallets[3].privkey )
if 'error' in resp:
print json.dumps(resp)
示例11: scenario
def scenario( wallets, **kw ):
# make a test namespace
resp = testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_name_import( "foo.test", wallets[3].addr, "11" * 20, wallets[1].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_namespace_ready( "test", wallets[1].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_name_update( "foo.test", "22" * 20, wallets[4].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
示例12: scenario
def scenario( wallets, **kw ):
resp = testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# should get rejected
resp = testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
# should get rejected (NOTE: the underlying mock utxo provider doesn't handle double-spends!)
resp = testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# should get accepted
resp = testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
# should get rejected (but only because the namespace isn't revealed until the block goes through)
resp = testlib.blockstore_namespace_ready( "test", wallets[1].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_namespace_ready( "test", wallets[1].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# should get rejected
resp = testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
if 'error' in resp:
print json.dumps( resp, indent=4 )
# should get rejected (NOTE: the underlying mock utxo provider doesn't handle double-spends!)
resp = testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# should succeed
resp = testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# (this should succeed)
resp = testlib.blockstore_name_update( "foo.test", "11" * 20, wallets[3].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
# (this should also succeed)
resp = testlib.blockstore_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# (this should succeed)
resp = testlib.blockstore_name_renew( "foo.test", wallets[4].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
# (this should also succeed)
resp = testlib.blockstore_name_update( "foo.test", "22" * 20, wallets[4].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
# (this should succeed)
resp = testlib.blockstore_name_transfer( "foo.test", wallets[3].addr, True, wallets[4].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# lots of updates
for i in xrange(0, 9):
resp = testlib.blockstore_name_update( "foo.test", ("%s%s" % (i,i)) * 20, wallets[3].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
#.........这里部分代码省略.........
示例13: scenario
def scenario( wallets, **kw ):
subsidy_wallet = wallets[5]
print json.dumps( testlib.getrawtransaction( "28f78fbae22d2273341af231a2ac049d74958e1e6ce6ae622cd48d8f0fef591e", 1 ), indent=4 )
resp = testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_namespace_ready( "test", wallets[1].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# subsidized transactions...
resp = testlib.blockstore_name_preorder( "foo.test", None, wallets[3].addr, subsidy_key=subsidy_wallet.privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
# (already subsidized...)
send_subsidized( None, resp, **kw )
testlib.next_block( **kw )
resp = testlib.blockstore_name_register( "foo.test", None, wallets[3].addr, subsidy_key=subsidy_wallet.privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
# (already subsidized...)
send_subsidized( None, resp, **kw )
testlib.next_block( **kw )
resp = testlib.blockstore_name_update( "foo.test", "11" * 20, None, user_public_key=wallets[3].pubkey_hex, subsidy_key=subsidy_wallet.privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
send_subsidized( wallets[3].privkey, resp, **kw )
testlib.next_block( **kw )
resp = testlib.blockstore_name_transfer( "foo.test", wallets[4].addr, True, None, user_public_key=wallets[3].pubkey_hex, subsidy_key=subsidy_wallet.privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
send_subsidized( wallets[3].privkey, resp, **kw )
testlib.next_block( **kw )
resp = testlib.blockstore_name_revoke( "foo.test", None, user_public_key=wallets[4].pubkey_hex, subsidy_key=subsidy_wallet.privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
send_subsidized( wallets[4].privkey, resp, **kw )
# advance a bit
for i in xrange(0, 5):
testlib.next_block( **kw )
示例14: scenario
def scenario( wallets, **kw ):
global last_consensus, snv_block_id
# make a test namespace
resp = testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_namespace_ready( "test", wallets[1].privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# preorder 3 names in the same block: foo.test, bar.test, baz.test
names = ['foo.test', 'bar.test', 'baz.test']
name_preorder_wallets = [wallets[2], wallets[3], wallets[4]]
name_register_wallets = [wallets[5], wallets[6], wallets[7]]
name_transfer_wallets = [wallets[6], wallets[7], wallets[5]]
resp = testlib.blockstore_name_preorder_multi( names, wallets[2].privkey, [wallets[5].addr, wallets[6].addr, wallets[7].addr])
if 'error' in resp:
print json.dumps( resp, indent=4 )
sys.exit(1)
testlib.next_block( **kw )
# regster 3 names in the same block
for i in xrange(0, len(names)):
name = names[i]
preorder_wallet = name_preorder_wallets[i]
register_wallet = name_register_wallets[i]
resp = testlib.blockstore_name_register( name, wallets[2].privkey, register_wallet.addr )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
snv_block_id = testlib.get_current_block( **kw )
# update 3 names in the same block
for i in xrange(0, len(names)):
name = names[i]
register_wallet = name_register_wallets[i]
resp = testlib.blockstore_name_update( name, str(i + 1) * 40, register_wallet.privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# transfer 3 names in the same block
for i in xrange(0, len(names)):
name = names[i]
register_wallet = name_register_wallets[i]
transfer_wallet = name_transfer_wallets[i]
resp = testlib.blockstore_name_transfer( name, transfer_wallet.addr, True, register_wallet.privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# exchange after transfer...
tmp = name_register_wallets
name_register_wallets = name_transfer_wallets
name_transfer_wallets = tmp
# renew 3 names in the same block
for i in xrange(0, len(names)):
name = names[i]
register_wallet = name_register_wallets[i]
resp = testlib.blockstore_name_renew( name, register_wallet.privkey )
if debug or 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# revoke 3 names in the same block
for i in xrange(0, len(names)):
name = names[i]
register_wallet = name_register_wallets[i]
resp = testlib.blockstore_name_revoke( name, register_wallet.privkey )
if debug or 'error' in resp:
#.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:blockstore,代码行数:101,代码来源:name_preorder_multi_register_update_transfer_renew_revoke_verify_snv.py
示例15: scenario
def scenario( wallets, **kw ):
testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
testlib.next_block( **kw )
resp = testlib.blockstore_name_import( "foo.test", wallets[2].addr, "11" * 20, wallets[1].privkey )
if 'error' in resp:
print json.dumps(resp, indent=4 )
testlib.next_block( **kw )
# try to exceed quota (currently 25): order 25, and try to register a 26th
for i in xrange(0, 25):
resp = testlib.blockstore_name_import( "foo%s.test" % i, wallets[3].addr, "22" * 20, wallets[1].privkey )
if 'error' in resp:
print json.dumps(resp, indent=4 )
testlib.next_block( **kw )
# try to exceed quota (currently 25): order 26, and try to update one of them (and try to transfer one too).
for i in xrange(0, 27):
resp = testlib.blockstore_name_import( "bar%s.test" % i, wallets[4].addr, "33" * 20, wallets[1].privkey )
if 'error' in resp:
print json.dumps(resp, indent=4 )
testlib.next_block( **kw )
testlib.blockstore_namespace_ready( "test", wallets[1].privkey )
testlib.next_block( **kw )
print wallets[3].privkey
resp = testlib.blockstore_name_preorder( "foofail.test", wallets[3].privkey, wallets[1].addr )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# should fail
resp = testlib.blockstore_name_register( "foofail.test",wallets[3].privkey, wallets[1].addr )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# should succeed
resp = testlib.blockstore_name_update( "foo0.test", '55' * 20, wallets[3].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
resp = testlib.blockstore_name_preorder( "barfail.test", wallets[4].privkey, wallets[2].addr )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# should fail (exceeded quota)
resp = testlib.blockstore_name_register( "barfail.test", wallets[4].privkey, wallets[2].addr )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# should fail (exceeded quota--have to revoke or give names away)
resp = testlib.blockstore_name_update( "bar0.test", '44' * 20, wallets[4].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# should succeed (give a name away)
resp = testlib.blockstore_name_transfer( "bar0.test", wallets[1].addr, True, wallets[4].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# should fail (exceeded quota--have to revoke or give names away)
resp = testlib.blockstore_name_update( "bar0.test", '44' * 20, wallets[4].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# should succeed (revoke a name)
resp = testlib.blockstore_name_revoke( "bar2.test", wallets[4].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
# should succeed (now under quota)
resp = testlib.blockstore_name_update( "bar1.test", '66' * 20, wallets[4].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
#.........这里部分代码省略.........
开发者ID:shaowenliu,项目名称:blockstore,代码行数:101,代码来源:namespace_preorder_reveal_import_multi_ready_quota.py