def reset_config(self): Node.reset_config_common(self, self.index, "arbiter", self.params.number) _config = self.config[constant.CONFIG_TITLE] _config[constant.CONFIG_MAGIC] = self.params.magic _config[constant.CONFIG_ACTIVE_NET] = self.params.active_net _config[constant.CONFIG_PRINT_LEVEL] = self.params.print_level _config[constant.CONFIG_SPV_PRINT_LEVEL] = self.params.spv_print_level _config[constant.CONFIG_ARBITER_MAIN_NODE] = self.gen_main_node() _config[constant.CONFIG_SIDE_NODE_LIST] = self.gen_side_node_list() _config[ constant. CONFIG_ORIGIN_CROSS_CHAIN_ARBITERS] = self.gen_origin_arbiters() _config[ constant.CONFIG_CRC_CROSS_CHAIN_ARBITERS] = self.gen_crc_arbiters( 1, self.params.crc_number + 1) _config[constant. CONFIG_CRC_ONLY_DPOS_HEIGHT] = self.params.crc_dpos_only_height if self.index > 4: index = self.index % 5 + 1 else: index = self.index _config[constant.CONFIG_DPOS_NET_ADDRESS] = "127.0.0.1:" + str( self.reset_port( index=index, node_type="ela", port_type="arbiter_node_port"))
def __init__(self, index: int, config: dict, cwd_dir: str): Node.__init__(self, config) self.index = index self.config = config self.process = None self.running = False self.cwd_dir = cwd_dir self.err_output = open(os.path.join(self.cwd_dir, "error.log"), 'w')
def __init__(self, index, config, params: TokenParams, keystore_manager: KeyStoreManager, cwd_dir: str): Node.__init__(self, config) self.tag = util.tag_from_path(__file__, self.__class__.__name__) self.index = index self.params = params self.keystore_manager = keystore_manager self.cwd_dir = cwd_dir self.rpc_port = self.reset_port(index, "token", "json_port") self.err_output = open(os.path.join(self.cwd_dir, "error.log"), 'w') self.process = None self.running = False
def reset_config(self): Node.reset_config_common(self, self.index, "ela", self.params.number) _config = self.config[constant.CONFIG_TITLE] if self.index == 0 or self.params.later_start_number != 0 \ and self.index >= self.params.number - int(self.params.later_start_number / 2) + 1: _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_ARBITER_ENABLE] = False self.arbiter_enable = False else: _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_ARBITER_ENABLE] = self.params.arbiter_enable self.arbiter_enable = self.params.arbiter_enable _config[constant.CONFIG_MAGIC] = self.params.magic _config[constant.CONFIG_PRINT_LEVEL] = self.params.print_level _config[constant.CONFIG_ACTIVE_NET] = self.params.active_net _config[constant.CONFIG_DISABLE_DNS] = self.params.disable_dns _config[constant.CONFIG_MIN_CROSS_CHAIN_FEE] = self.params.min_cross_fee _config[constant.CONFIG_FOUNDATION_ADDRESS] = self.keystore_manager.foundation_account.address() _config[constant.CONFIG_POW][constant.CONFIG_PAY_TO_ADDR] = self.keystore_manager.main_miner_account.address() _config[constant.CONFIG_POW][constant.CONFIG_AUTO_MINING] = self.params.auto_mining _config[constant.CONFIG_POW][constant.CONFIG_INSTANT_BLOCK] = self.params.instant_block _config[constant.CONFIG_CHECK_ADDRESS_HEIGHT] = self.params.check_address_height _config[constant.CONFIG_VOTE_START_HEIGHT] = self.params.vote_start_height _config[constant.CONFIG_ONLY_DPOS_HEIGHT] = self.params.crc_dpos_height _config[constant.CONFIG_PUBLIC_DPOS_HEIGHT] = self.params.public_dpos_height # rpc accept set _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_PUBLIC_KEY] = self.node_account.public_key() _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_PORT_DPOS] = self.reset_port( self.index, "ela", "arbiter_node_port" ) _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_IP_ADDRESS] = self.params.ip_address _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_PRINT_LEVEL] = self.params.print_level _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_ORIGIN_ARBITERS] = self.gen_original_arbiter() _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_CRC_ARBITERS] = self.gen_crc_config() _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_NORMAL_ARBITERS_COUNT] = \ self.params.crc_number * 2 _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_EMERGENCY_INACTIVE_PENALTY] = \ self.params.emergency_inactive_penalty _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_INACTIVE_PENALTY] = self.params.inactive_penalty _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_CANDIDATES_COUNT] = self.params.crc_number * 6 _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_PRE_CONNECT_OFFSET] = \ self.params.pre_connect_offset _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_MAX_INACTIVATE_ROUNDS] = \ self.params.max_inactivate_rounds
def reset_config(self): Node.reset_config_common(self, self.index, "token", self.params.number) _config = self.config _config[constant.CONFIG_ACTIVE_NET] = self.params.active_net _config[constant.CONFIG_MAGIC] = self.params.magic _config[constant.CONFIG_PORT_NODE] = self.reset_port( index=self.index, node_type="token", port_type="node_port" ) _config[constant.CONFIG_SPV_MAGIC] = self.params.spv_magic _config[constant.CONFIG_DISABLE_DNS] = self.params.disable_dns _config[constant.CONFIG_PERMANENT_PEERS] = self.gen_permanent_list() _config[constant.CONFIG_SIDE_SPV_DISABLE_DNS] = self.params.spv_disable_dns _config[constant.CONFIG_SIDE_SPV_PERMANENT_PEERS] = self.gen_spv_permanent_list() _config[constant.CONFIG_SIDE_ENABLE_REST] = self.params.rest_port_enable _config[constant.CONFIG_SIDE_PORT_REST] = self.reset_port( index=self.index, node_type="token", port_type="rest_port" ) _config[constant.CONFIG_SIDE_ENABLE_WS] = self.params.ws_port_enable _config[constant.CONFIG_SIDE_PORT_WS] = self.reset_port( index=self.index, node_type="token", port_type="ws_port" ) _config[constant.CONFIG_SIDE_ENABLE_RPC] = self.params.rpc_port_enable _config[constant.CONFIG_SIDE_PORT_RPC] = self.reset_port( index=self.index, node_type="token", port_type="json_port" ) _config[constant.CONFIG_SIDE_RPC_USER] = "" _config[constant.CONFIG_SIDE_RPC_PASS] = "" _config[constant.CONFIG_SIDE_RPC_WHITE_LIST] = ["0.0.0.0"] _config[constant.CONFIG_SIDE_LOG_LEVEL] = self.params.log_level _config[constant.CONFIG_SIDE_ENABLE_MINING] = self.params.mining_enable _config[constant.CONFIG_INSTANT_BLOCK] = self.params.instant_block _config[constant.CONFIG_PAY_TO_ADDR] = self.keystore_manager.side_miner_account.address() _config[constant.CONFIG_FOUNDATION_ADDRESS] = self.keystore_manager.foundation_account.address()
def __init__(self, index: int, config, params: ElaParams, keystore_manager: KeyStoreManager, cwd_dir: str, ela_type: str): Node.__init__(self, config) self.tag = util.tag_from_path(__file__, self.__class__.__name__) self.index = index self.params = params self.keystore_manager = keystore_manager self.name = "" self.type = ela_type self.owner_account = keystore_manager.owner_accounts[self.index] self.node_account = keystore_manager.node_accounts[self.index] self.cwd_dir = cwd_dir self.password = self.params.password self.rpc_port = self.reset_port(self.index, "ela", "json_port") self.arbiter_node_port = self.reset_port(self.index, "ela", "arbiter_node_port") self.err_output = open(os.path.join(self.cwd_dir, "error.log"), 'w') self.arbiter_enable = False self.process = None self.running = False self.set_name()
def reset_config(self): Node.reset_config_common(self, self.index, "ela", self.params.number) _config = self.config[constant.CONFIG_TITLE] if self.index == 0 or self.params.later_start_number != 0 \ and self.index >= self.params.number - int(self.params.later_start_number / 2) + 1: _config[constant.CONFIG_ARBITER_CONFIGURATION][ constant.CONFIG_ARBITER_ENABLE] = False self.arbiter_enable = False else: _config[constant.CONFIG_ARBITER_CONFIGURATION][ constant.CONFIG_ARBITER_ENABLE] = self.params.arbiter_enable self.arbiter_enable = self.params.arbiter_enable _config[constant.CONFIG_MAGIC] = self.params.magic _config[constant.CONFIG_PRINT_LEVEL] = self.params.print_level _config[constant.CONFIG_ACTIVE_NET] = self.params.active_net _config[constant.CONFIG_DISABLE_DNS] = self.params.disable_dns _config[ constant. CONFIG_FOUNDATION_ADDRESS] = self.keystore_manager.foundation_account.address( ) _config[constant.CONFIG_POW][ constant. CONFIG_PAY_TO_ADDR] = self.keystore_manager.main_miner_account.address( ) _config[constant.CONFIG_POW][ constant.CONFIG_AUTO_MINING] = self.params.auto_mining _config[constant.CONFIG_POW][ constant.CONFIG_INSTANT_BLOCK] = self.params.instant_block _config[constant. CONFIG_CHECK_ADDRESS_HEIGHT] = self.params.check_address_height _config[ constant.CONFIG_VOTE_START_HEIGHT] = self.params.vote_start_height _config[constant.CONFIG_ONLY_DPOS_HEIGHT] = self.params.crc_dpos_height _config[constant. CONFIG_PUBLIC_DPOS_HEIGHT] = self.params.public_dpos_height _config[constant.MAX_NODE_PER_HOST] = self.params.max_node_per_host # cr set _config[constant.CONFIG_CR_CONFIGURATION][ constant. CONFIG_CR_VOTING_START_HEIGHT] = self.params.cr_voting_start_height _config[constant.CONFIG_CR_CONFIGURATION][ constant. CONFIG_CR_COMMITTEE_START_HEIGHT] = self.params.cr_committee_start_height _config[constant.CONFIG_CR_CONFIGURATION][ constant. CONFIG_MEMBER_COUNT] = self.params.crc_number ## crc_number = member_count _config[constant.CONFIG_CR_CONFIGURATION][ constant.CONFIG_CR_VOTING_PERIOD] = self.params.cr_voting_period _config[constant.CONFIG_CR_CONFIGURATION][ constant.CONFIG_CR_DUTY_PERIOD] = self.params.cr_duty_period _config[constant.CONFIG_CR_CONFIGURATION][ constant. CONFIG_DEPOSIT_LOCKUP_BLOCKS] = self.params.deposit_lockup_blocks _config[constant.CONFIG_CR_CONFIGURATION][ constant. CONFIG_CRC_APPROPRIATE_PERCENTAGE] = self.params.crc_appropriate_percentage _config[constant.CONFIG_CR_CONFIGURATION][ constant. CONFIG_MAX_COMMITTEE_PROPOSAL_COUNT] = self.params.max_committee_proposal_count _config[constant.CONFIG_CR_CONFIGURATION][ constant. CONFIG_MAX_PROPOSAL_TRACKING_COUNT] = self.params.max_proposal_tracking_count _config[constant.CONFIG_CR_CONFIGURATION][ constant. CONFIG_PROPOSAL_CR_VOTING_PERIOD] = self.params.proposal_cr_voting_period _config[constant.CONFIG_CR_CONFIGURATION][ constant. CONFIG_PROPOSAL_PUBLIC_VOTING_PERIOD] = self.params.proposal_public_voting_period _config[constant.CONFIG_CR_CONFIGURATION][ constant. CONFIG_CR_AGREEMENT_COUNT] = self.params.cr_agreement_count _config[constant.CONFIG_CR_CONFIGURATION][ constant. CONFIG_VOTER_REJECT_PERCENTAGE] = self.params.voter_reject_percentage _config[constant.CONFIG_CR_CONFIGURATION][ constant. CONFIG_REGISTER_CR_BY_DID_HEIGHT] = self.params.register_cr_by_did_height _config[constant.CONFIG_CR_CONFIGURATION][ constant. CR_CLAIM_DPOS_NODE_START_HEIGHT] = self.params.cr_claim_dpos_node_start_height _config[ constant. CONFIG_CR_CHECK_REWARD_HEIGHT] = self.params.cr_check_reward_height # rpc accept set _config[constant.CONFIG_ARBITER_CONFIGURATION][ constant.CONFIG_PUBLIC_KEY] = self.node_account.public_key() _config[constant.CONFIG_ARBITER_CONFIGURATION][ constant.CONFIG_PORT_DPOS] = self.reset_port( self.index, "ela", "arbiter_node_port") _config[constant.CONFIG_ARBITER_CONFIGURATION][ constant.CONFIG_IP_ADDRESS] = self.params.ip_address _config[constant.CONFIG_ARBITER_CONFIGURATION][ constant.CONFIG_PRINT_LEVEL] = self.params.print_level _config[constant.CONFIG_ARBITER_CONFIGURATION][ constant.CONFIG_ORIGIN_ARBITERS] = self.gen_original_arbiter() _config[constant.CONFIG_ARBITER_CONFIGURATION][ constant.CONFIG_CRC_ARBITERS] = self.gen_crc_config() _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_NORMAL_ARBITERS_COUNT] = \ self.params.crc_number * 2 _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_EMERGENCY_INACTIVE_PENALTY] = \ self.params.emergency_inactive_penalty _config[constant.CONFIG_ARBITER_CONFIGURATION][ constant.CONFIG_INACTIVE_PENALTY] = self.params.inactive_penalty _config[constant.CONFIG_ARBITER_CONFIGURATION][ constant.CONFIG_CANDIDATES_COUNT] = self.params.crc_number * 6 _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_PRE_CONNECT_OFFSET] = \ self.params.pre_connect_offset _config[constant.CONFIG_ARBITER_CONFIGURATION][constant.CONFIG_MAX_INACTIVATE_ROUNDS] = \ self.params.max_inactivate_rounds