コード例 #1
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 

    # preordered
    preorder = state_engine.get_name_preorder( "foo.test", pybitcoin.make_pay_to_address_script(wallets[2].addr), wallets[3].addr )
    if preorder is None:
        return False
    
    # paid fee 
    if preorder['op_fee'] < blockstored.get_name_cost( 'foo.test' ):
        print "Insufficient fee"
        return False 

    return True
コード例 #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

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

    # paid fee
    if preorder['op_fee'] < blockstored.get_name_cost('foo.test'):
        print "Insufficient fee"
        return False

    return True
コード例 #3
0
def check(state_engine):

    global preorder_consensus

    # 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

    # there will be a multi-preorder
    preorder = state_engine.get_name_multi_preorder( ['foo.test', 'bar.test', 'baz.test'], \
                                                     pybitcoin.make_pay_to_address_script(wallets[2].addr), \
                                                     [wallets[3].addr, wallets[4].addr, wallets[5].addr])

    if preorder is None:
        print "no preorder found for foo.test, bar.test, baz.test"
        return False

    if preorder['op_fee'] < blockstored.get_name_cost(
            'foo.test') + blockstored.get_name_cost(
                'bar.test') + blockstored.get_name_cost('baz.test'):
        print "Insufficient fee"
        return False

    if not state_engine.is_sender_multi_preordering(
            pybitcoin.make_pay_to_address_script(wallets[2].addr)):
        print "Inconsistent state: preorder exists, but not preordering"
        return False

    # our names should not be registered
    for n in ['foo.test', 'bar.test', 'baz.test']:
        name_rec = state_engine.get_name(n)
        if name_rec is not None:
            print "Name registered: %s" % n
            return False

    return True
コード例 #4
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

    # there won't be a preorder for an individual name...
    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 "found name preorder for 'foo.test'"
        return False

    # but there will be a multi-preorder
    preorder = state_engine.get_name_multi_preorder(
        ["foo.test", "bar.test", "baz.test"],
        pybitcoin.make_pay_to_address_script(wallets[2].addr),
        [wallets[3].addr, wallets[4].addr, wallets[5].addr],
    )

    if preorder is None:
        print "no preorder found for foo.test, bar.test, baz.test"
        return False

    if preorder["op_fee"] < blockstored.get_name_cost("foo.test") + blockstored.get_name_cost(
        "bar.test"
    ) + blockstored.get_name_cost("baz.test"):
        print "Insufficient fee"
        return False

    if not state_engine.is_sender_multi_preordering(pybitcoin.make_pay_to_address_script(wallets[2].addr)):
        print "Inconsistent state: preorder exists, but not preordering"
        return False

    return True
def check( state_engine ):

    global preorder_consensus

    # 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 

    # there will be a multi-preorder 
    preorder = state_engine.get_name_multi_preorder( ['foo.test', 'bar.test', 'baz.test'], \
                                                     pybitcoin.make_pay_to_address_script(wallets[2].addr), \
                                                     [wallets[3].addr, wallets[4].addr, wallets[5].addr])

    if preorder is None:
        print "no preorder found for foo.test, bar.test, baz.test"
        return False

    if preorder['op_fee'] < blockstored.get_name_cost( 'foo.test' ) + blockstored.get_name_cost( 'bar.test' ) + blockstored.get_name_cost( 'baz.test' ):
        print "Insufficient fee"
        return False 

    if not state_engine.is_sender_multi_preordering( pybitcoin.make_pay_to_address_script(wallets[2].addr) ):
        print "Inconsistent state: preorder exists, but not preordering"
        return False 

    # our names should not be registered 
    for n in ['foo.test', 'bar.test', 'baz.test']:
        name_rec = state_engine.get_name( n )
        if name_rec is not None:
            print "Name registered: %s" % n
            return False 

    return True
コード例 #6
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 

    # there won't be a preorder for an individual name...
    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 "found name preorder for 'foo.test'"
        return False
   
    # but there will be a multi-preorder 
    preorder = state_engine.get_name_multi_preorder( ['foo.test', 'bar.test', 'baz.test'], \
                                                     pybitcoin.make_pay_to_address_script(wallets[2].addr), \
                                                     [wallets[3].addr, wallets[4].addr, wallets[5].addr])

    if preorder is None:
        print "no preorder found for foo.test, bar.test, baz.test"
        return False

    if preorder['op_fee'] < blockstored.get_name_cost( 'foo.test' ) + blockstored.get_name_cost( 'bar.test' ) + blockstored.get_name_cost( 'baz.test' ):
        print "Insufficient fee"
        return False 

    if not state_engine.is_sender_multi_preordering( pybitcoin.make_pay_to_address_script(wallets[2].addr) ):
        print "Inconsistent state: preorder exists, but not preordering"
        return False 

    return True