def check( state_engine ):

    # not revealed, but ready 
    ns = state_engine.get_namespace_reveal( "test" )
    if ns is not None:
        return False 

    ns = state_engine.get_namespace( "test" )
    if ns is None:
        return False 

    if ns['namespace_id'] != 'test':
        return False 

    # not preordered
    preorder = state_engine.get_name_preorder( "foo.test", pybitcoin.make_pay_to_address_script(wallets[2].addr), wallets[3].addr )
    if preorder is not None:
        return False
    
    # not registered 
    name_rec = state_engine.get_name( "foo.test" )
    if name_rec is not None:
        print "Not expired:"
        print json.dumps( name_rec, indent=4 )
        return False 

    #  snv lookup works
    test_proxy = testlib.TestAPIProxy()
    snv_rec = snv_client.lookup_snv( "foo.test", snv_block_id, snv_consensus, proxy=test_proxy )
    if 'error' in snv_rec:
        print json.dumps(snv_rec, indent=4 )
        return False

    print snv_rec 
    return True 
Beispiel #2
0
def check(state_engine):

    # not revealed, but ready
    ns = state_engine.get_namespace_reveal("test")
    if ns is not None:
        return False

    ns = state_engine.get_namespace("test")
    if ns is None:
        return False

    if ns['namespace_id'] != 'test':
        return False

    # not preordered
    preorder = state_engine.get_name_preorder(
        "foo.test", 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.test")
    if name_rec is None:
        print "no such name"
        return False

    # owned by
    if name_rec['address'] != wallets[3].addr or name_rec[
            'sender'] != pybitcoin.make_pay_to_address_script(wallets[3].addr):
        print "wrong owner"
        return False

    # revoked
    if not name_rec['revoked']:
        return False

    # snv lookup works
    test_proxy = testlib.TestAPIProxy()
    snv_rec = snv_client.lookup_snv("foo.test",
                                    snv_block_id,
                                    snv_consensus,
                                    proxy=test_proxy)
    if 'error' in snv_rec:
        print json.dumps(snv_rec, indent=4)
        return False

    print snv_rec

    return True
def check(state_engine):

    # not revealed, but ready
    ns = state_engine.get_namespace_reveal("test")
    if ns is not None:
        print "'test' not revealed"
        return False

    ns = state_engine.get_namespace("test")
    if ns is None:
        print "'test' not found"
        return False

    if ns['namespace_id'] != 'test':
        print "'test' not returned"
        return False

    # not preordered
    preorder = state_engine.get_name_preorder(
        "foo.test", pybitcoin.make_pay_to_address_script(wallets[2].addr),
        wallets[3].addr)
    if preorder is not None:
        print "'foo.test' still preordered"
        return False

    # registered
    name_rec = state_engine.get_name("foo.test")
    if name_rec is None:
        print "'foo.test' not registered"
        return False

    # transferred
    if name_rec['address'] != wallets[4].addr or name_rec[
            'sender'] != pybitcoin.make_pay_to_address_script(wallets[4].addr):
        print "'foo.test' invalid owner"
        return False

    test_proxy = testlib.TestAPIProxy()
    snv_rec = snv_client.lookup_snv("foo.test",
                                    snv_block_id,
                                    snv_consensus,
                                    proxy=test_proxy)
    if 'error' in snv_rec:
        print json.dumps(snv_rec, indent=4)
        return False

    print snv_rec
    return True
def check(state_engine):

    # not revealed, but ready
    ns = state_engine.get_namespace_reveal("test")
    if ns is not None:
        print "'test' not revealed"
        return False

    ns = state_engine.get_namespace("test")
    if ns is None:
        print "'test' not found"
        return False

    if ns["namespace_id"] != "test":
        print "'test' not returned"
        return False

    # not preordered
    preorder = state_engine.get_name_preorder(
        "foo.test", pybitcoin.make_pay_to_address_script(wallets[2].addr), wallets[3].addr
    )
    if preorder is not None:
        print "'foo.test' still preordered"
        return False

    # registered
    name_rec = state_engine.get_name("foo.test")
    if name_rec is None:
        print "'foo.test' not registered"
        return False

    # transferred
    if name_rec["address"] != wallets[4].addr or name_rec["sender"] != pybitcoin.make_pay_to_address_script(
        wallets[4].addr
    ):
        print "'foo.test' invalid owner"
        return False

    test_proxy = testlib.TestAPIProxy()
    snv_rec = snv_client.lookup_snv("foo.test", snv_block_id, snv_consensus, proxy=test_proxy)
    if "error" in snv_rec:
        print json.dumps(snv_rec, indent=4)
        return False

    print snv_rec
    return True
def check( state_engine ):

    # not revealed, but ready 
    ns = state_engine.get_namespace_reveal( "test" )
    if ns is not None:
        return False 

    ns = state_engine.get_namespace( "test" )
    if ns is None:
        return False 

    if ns['namespace_id'] != 'test':
        return False 

    # not preordered
    preorder = state_engine.get_name_preorder( "foo.test", pybitcoin.make_pay_to_address_script(wallets[2].addr), wallets[3].addr )
    if preorder is not None:
        return False
    
    # registered 
    name_rec = state_engine.get_name( "foo.test" )
    if name_rec is None:
        return False

    # owned by
    if name_rec['address'] != wallets[3].addr or name_rec['sender'] != pybitcoin.make_pay_to_address_script(wallets[3].addr):
        return False

    # renewed (11 blocks later)
    if name_rec['last_renewed'] - 11 != name_rec['first_registered']:
        print name_rec['last_renewed']
        print name_rec['first_registered']
        return False

    # snv lookup works
    test_proxy = testlib.TestAPIProxy()
    snv_rec = snv_client.lookup_snv( "foo.test", snv_block_id, snv_consensus, proxy=test_proxy )
    if 'error' in snv_rec:
        print json.dumps(snv_rec, indent=4 )
        return False

    print snv_rec 
    return True