コード例 #1
0
def test(testfilter):
    global datadir1
    global datadir2

    _lib.StartTestGroup("Import long blockchain")

    _lib.CleanTestFolders()

    _lib.StartTestGroup("Copy blockchain from dataset")

    datadir1 = _lib.CreateTestFolder()
    datadir2 = _lib.CreateTestFolder()

    _lib.CopyTestData(datadir1, "bigchain")

    balances = _transfers.GetGroupBalance(datadir1)
    address = balances.keys()[0]

    startnode.StartNode(datadir1, address, '30000', "Server 1")

    address2 = initblockchain.ImportBockchain(datadir2, "localhost", '30000')

    #managenodes.RemoveAllNodes(datadir1)

    startnode.StartNode(datadir2, address2, '30001', "Server 2")

    #managenodes.RemoveAllNodes(datadir2)

    #managenodes.AddNode(datadir1, "localhost",'30001')

    blocks1 = _blocks.GetBlocks(datadir1)

    state = _node.NodeState(datadir1)

    _node.WaitBlocksInState(datadir2, len(blocks1), 120)

    blocks2 = _blocks.WaitBlocks(datadir2, len(blocks1), 120)

    #print len(blocks1), len(blocks2)

    _lib.FatalAssert(
        len(blocks1) == len(blocks2),
        "Number of bocks must be same on both servers")

    startnode.StopNode(datadir1, "Server 1")
    startnode.StopNode(datadir2, "Server 2")

    datadir1 = ""
    datadir2 = ""

    _lib.EndTestGroupSuccess()
コード例 #2
0
def Copy6Nodes():
    datadirs = [""] * 6
    datadirs[0] = _lib.CreateTestFolder("_1_")
    _lib.CopyTestData(datadirs[0],"bc6nodes_1")
    
    datadirs[1] = _lib.CreateTestFolder("_2_")
    _lib.CopyTestData(datadirs[1],"bc6nodes_2")
    
    datadirs[2] = _lib.CreateTestFolder("_3_")
    _lib.CopyTestData(datadirs[2],"bc6nodes_3")
    
    datadirs[3] = _lib.CreateTestFolder("_4_")
    _lib.CopyTestData(datadirs[3],"bc6nodes_4")
    
    datadirs[4] = _lib.CreateTestFolder("_5_")
    _lib.CopyTestData(datadirs[4],"bc6nodes_5")
    
    datadirs[5] = _lib.CreateTestFolder("_6_")
    _lib.CopyTestData(datadirs[5],"bc6nodes_6")
    
    return datadirs
コード例 #3
0
def CopyBlockchainWithBlocks():
    datadir = _lib.CreateTestFolder()
    _lib.CopyTestData(datadir, "bcwith4blocks")

    return datadir