mirror of
https://github.com/fluencelabs/registry.git
synced 2025-04-24 17:52:14 +00:00
aqua: fix relay for host record lifecycle (#93)
This commit is contained in:
parent
78dafff714
commit
d7c62a57d9
@ -14,8 +14,8 @@ func get_record_signature(route_id: string, value: string, relay_id: ?PeerId, se
|
||||
signature <- Sig.sign(bytes)
|
||||
<- signature.signature!
|
||||
|
||||
func get_host_record_signature(route_id: string, value: string, relay_id: ?PeerId, service_id: ?string, timestamp_created: u64) -> []u8:
|
||||
on HOST_PEER_ID:
|
||||
func get_host_record_signature(provider_node_id: PeerId, route_id: string, value: string, relay_id: ?PeerId, service_id: ?string, timestamp_created: u64) -> []u8:
|
||||
on provider_node_id:
|
||||
bytes <- Registry.get_host_record_bytes(route_id, value, relay_id, service_id, timestamp_created, nil)
|
||||
signature <- Sig.sign(bytes)
|
||||
<- signature.signature!
|
||||
@ -40,6 +40,6 @@ func put_host_record(route_id: string, value: string, relay_id: ?PeerId, service
|
||||
|
||||
func propagate_host_record(res: PutHostRecordResult) -> DhtResult:
|
||||
t <- Peer.timestamp_sec()
|
||||
weight <- TrustGraph.get_weight(%init_peer_id%, t)
|
||||
weight <- TrustGraph.get_weight(res.value!.peer_id, t)
|
||||
result <- Registry.propagate_host_record(res, t, weight)
|
||||
<- result
|
||||
|
@ -100,7 +100,7 @@ func createRouteAndRegisterNode(provider_node_id: PeerId, label: string, value:
|
||||
on HOST_PEER_ID:
|
||||
route_id <- get_route_id(label, INIT_PEER_ID)
|
||||
|
||||
record_signature <- get_host_record_signature(route_id, value, nil, service_id, t)
|
||||
record_signature <- get_host_record_signature(provider_node_id, route_id, value, nil, service_id, t)
|
||||
|
||||
on provider_node_id:
|
||||
register_route(label, t, route_signature, false)
|
||||
@ -124,7 +124,7 @@ func createRouteAndRegisterNodeBlocking(
|
||||
on HOST_PEER_ID:
|
||||
route_id <- get_route_id(label, INIT_PEER_ID)
|
||||
|
||||
record_signature <- get_host_record_signature(route_id, value, nil, service_id, t)
|
||||
record_signature <- get_host_record_signature(provider_node_id, route_id, value, nil, service_id, t)
|
||||
|
||||
results: *DhtResult
|
||||
on provider_node_id:
|
||||
@ -162,7 +162,7 @@ func registerForRoute(route_id: RouteId, value: string, service_id: ?string):
|
||||
-- Note: route must be already initiated
|
||||
func registerForRouteNode(provider_node_id: PeerId, route_id: RouteId, value: string, service_id: ?string):
|
||||
t <- Peer.timestamp_sec()
|
||||
record_signature <- get_host_record_signature(route_id, value, nil, service_id, t)
|
||||
record_signature <- get_host_record_signature(provider_node_id, route_id, value, nil, service_id, t)
|
||||
|
||||
on provider_node_id:
|
||||
r <- put_host_record(route_id, value, nil, service_id, t, record_signature)
|
||||
|
Loading…
x
Reference in New Issue
Block a user