def test_build_one_node_privatechain(self): ''' 部署单节点私链 ''' auto = AutoDeployPlaton(genesis=conf.GENESIS_TEMPLATE2) auto.start_of_list(self.nocollusion_list[0:1], genesis_path=conf.GENESIS_TMP_OTHER) time.sleep(2) w3 = connect_web3(self.one_collusion_url) start_block = w3.eth.blockNumber log.info("start block number:{}".format(start_block)) time.sleep(10) end_block = w3.eth.blockNumber log.info("end block number:{}".format(end_block)) assert start_block < end_block, "区块高度没有增长"
def test_syncmode(self): """ 同步 :return: """ auto = AutoDeployPlaton(syncmode="fast") auto.start_of_list(self.nocollusion_list[0:1], genesis_file=self.genesis_file) time.sleep(2) w3 = connect_web3(self.one_collusion_url) w3.admin.addPeer(self.enode_list[0]) time.sleep(5) collusion_w3 = self.w3_list[0] if collusion_w3.eth.blockNumber < 250: log.info("sleep,非共识节点需要229个块之后才会开始同步") time.sleep(250 - collusion_w3.eth.blockNumber) assert w3.net.peerCount > 0, "加入链失败" assert w3.eth.blockNumber >= 200, "区块同步失败,当前块高{}".format( w3.eth.blockNumber)