examples/snapshot/aqua-scripts/timestamp_getter.aqua
2021-07-12 21:26:53 -05:00

24 lines
535 B
Plaintext

import "@fluencelabs/aqua-lib/builtin.aqua"
service OpTS("op"):
identity(s: u64)
array(a: string, b: u64) -> []string
service ToU32("op"):
identity(x:u32) -> u32
func ts_getter(node: string, n_neighbors:u32) -> []u64:
res: *u64
none_bool: *bool
nsize: *u32
nsize <- ToU32.identity(n_neighbors)
on node:
k <- Op.string_to_b58(node)
nodes <- Kademlia.neighborhood(k, none_bool, nsize)
for n <- nodes par:
on n:
try:
res <- Peer.timestamp_ms()
OpTS.identity(res!9)
<- res