Exemplo n.º 1
0
 def node(
     self,
     private_key: Optional[keys.PrivateKey] = None,
     endpoint: Optional[Endpoint] = None,
     enr_db: Optional[ENRDatabaseAPI] = None,
     events: Optional[EventsAPI] = None,
 ) -> Node:
     if private_key is None:
         private_key = PrivateKeyFactory()
     if endpoint is None:
         endpoint = EndpointFactory.localhost()
     if enr_db is None:
         enr_db = ENRDB({})
     return Node(private_key=private_key,
                 endpoint=endpoint,
                 enr_db=enr_db,
                 events=events)
Exemplo n.º 2
0
 def node(
     self,
     private_key: Optional[keys.PrivateKey] = None,
     endpoint: Optional[Endpoint] = None,
     enr_db: Optional[QueryableENRDatabaseAPI] = None,
     events: Optional[EventsAPI] = None,
     name: Optional[str] = None,
 ) -> Node:
     if private_key is None:
         private_key = PrivateKeyFactory()
     if endpoint is None:
         endpoint = EndpointFactory.localhost()
     if enr_db is None:
         enr_db = QueryableENRDB(sqlite3.connect(":memory:"))
     node = Node(private_key=private_key,
                 endpoint=endpoint,
                 enr_db=enr_db,
                 events=events)
     self.logger.info("Tester[Node]: name=%s  node_id=%s", name,
                      node.node_id.hex())
     return node