Merge branch 'main' of https://git.mamahaha.work/sangge/mimajingsai into sangge-main

This commit is contained in:
dqy
2023-10-24 18:58:49 +08:00
3 changed files with 10 additions and 8 deletions

View File

@@ -212,7 +212,7 @@ class IP_Message(BaseModel):
dest_ip: str
message_name: str
source_ip: str
pk: int
pk: Tuple[int, int]
class Request_Message(BaseModel):
@@ -301,7 +301,7 @@ async def recieve_request(i_m: IP_Message):
if source_ip != i_m.dest_ip:
return HTTPException(status_code=400, detail="Wrong ip")
dest_ip = i_m.source_ip
threshold = random.randrange(1, 6)
threshold = random.randrange(1, 2)
own_public_key = pk
pk_B = i_m.pk
@@ -320,7 +320,7 @@ async def recieve_request(i_m: IP_Message):
message = b"hello world" + random.randbytes(8)
# send message to nodes
await send_messages(node_ips, message, dest_ip, pk_B, threshold) # type: ignore
await send_messages(tuple(node_ips), message, dest_ip, pk_B, threshold)
response = {"threshold": threshold, "public_key": own_public_key}
return response