示例#1
0
def scenario( wallets, **kw ):

    global owner_address, payment_address

    testlib.ysi_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
    testlib.next_block( **kw )

    testlib.ysi_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.ysi_namespace_ready( "test", wallets[1].privkey )
    testlib.next_block( **kw )

    payment_address = wallets[5].addr
    owner_address = wallets[6].addr

    testlib.delete_wallet()
    wallet_files = testlib.list_wallet_backups()
    if len(wallet_files) > 0:
        print "still have {}".format(wallet_files)
        return False

    # import a single-sig wallet, with a data key
    payment_str = "{},{},{},{},{}".format(2,3,wallets[5].pks[0],wallets[5].pks[1],wallets[5].pks[2])
    owner_str = "{},{},{},{},{}".format(2,3,wallets[6].pks[0],wallets[6].pks[1],wallets[6].pks[2])

    res = testlib.ysi_cli_import_wallet( "0123456789abcdef", payment_str, owner_str, wallets[4].privkey )
    if 'error' in res:
        print json.dumps(res, indent=4, sort_keys=True)
        return False

    # should still be none
    wallet_files = testlib.list_wallet_backups()
    if len(wallet_files) > 0:
        print "still have {} after import".format(wallet_files)
        return False

    testlib.start_api("0123456789abcdef")

    # register
    resp = testlib.ysi_cli_register( "foo.test", "0123456789abcdef" )
    if 'error' in resp:
        print >> sys.stderr, json.dumps(resp, indent=4, sort_keys=True)
        return False
   
    # wait for the preorder to get confirmed
    for i in xrange(0, 12):
        testlib.next_block( **kw )

    # wait for the poller to pick it up
    print >> sys.stderr, "Waiting 10 seconds for the backend to submit the register"
    time.sleep(10)

    # wait for the register to get confirmed 
    for i in xrange(0, 12):
        testlib.next_block( **kw )

    print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge registration"
    time.sleep(10)

    # wait for update to get confirmed 
    for i in xrange(0, 12):
        testlib.next_block( **kw )

    print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge update"
    time.sleep(10)
def scenario( wallets, **kw ):

    global owner_address, payment_address

    testlib.blockstack_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
    testlib.next_block( **kw )

    testlib.blockstack_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.blockstack_namespace_ready( "test", wallets[1].privkey )
    testlib.next_block( **kw )

    payment_address = wallets[5].addr
    owner_address = wallets[6].addr

    testlib.delete_wallet()
    wallet_files = testlib.list_wallet_backups()
    if len(wallet_files) > 0:
        print "still have {}".format(wallet_files)
        return False

    # import a single-sig wallet, with a data key
    payment_str = "{},{},{},{},{}".format(2,3,wallets[5].pks[0],wallets[5].pks[1],wallets[5].pks[2])
    owner_str = "{},{},{},{},{}".format(2,3,wallets[6].pks[0],wallets[6].pks[1],wallets[6].pks[2])

    res = testlib.blockstack_cli_import_wallet( "0123456789abcdef", payment_str, owner_str, wallets[4].privkey )
    if 'error' in res:
        print json.dumps(res, indent=4, sort_keys=True)
        return False

    # should still be none
    wallet_files = testlib.list_wallet_backups()
    if len(wallet_files) > 0:
        print "still have {} after import".format(wallet_files)
        return False

    testlib.start_api("0123456789abcdef")

    # register
    resp = testlib.blockstack_cli_register( "foo.test", "0123456789abcdef" )
    if 'error' in resp:
        print >> sys.stderr, json.dumps(resp, indent=4, sort_keys=True)
        return False
   
    # wait for the preorder to get confirmed
    for i in xrange(0, 12):
        testlib.next_block( **kw )

    # wait for the poller to pick it up
    print >> sys.stderr, "Waiting 10 seconds for the backend to submit the register"
    time.sleep(10)

    # wait for the register to get confirmed 
    for i in xrange(0, 12):
        testlib.next_block( **kw )

    print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge registration"
    time.sleep(10)

    # wait for update to get confirmed 
    for i in xrange(0, 12):
        testlib.next_block( **kw )

    print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge update"
    time.sleep(10)