def load_peers(self) -> None: PeerLoader.load(peer_manager=self) blockchain = ObjectManager().channel_service.block_manager.blockchain reps_hash = self.reps_hash() reps_in_db = blockchain.find_preps_by_roothash(reps_hash) if not reps_in_db: preps = self.serialize_as_preps() util.logger.spam(f"in _load_peers serialize_as_preps({preps})") blockchain.write_preps(reps_hash, preps)
def load_peers(self) -> None: blockchain = ObjectManager().channel_service.block_manager.blockchain if not blockchain.is_roothash_exist_in_db(self._crep_root_hash): reps_hash, reps = PeerLoader.load() util.logger.info(f"Initial Loaded Reps: {reps}") for order, rep_info in enumerate(reps, 1): peer = Peer(rep_info['id'], rep_info['p2pEndpoint'], order=order) self.add_peer( peer ) # add_peer still needed for now, but It will be removed. if not blockchain.is_roothash_exist_in_db(reps_hash): blockchain.write_preps(reps_hash, reps)