examples/snapshot/aqua-scripts/timestamp_getter.aqua

24 lines
535 B
Plaintext
Raw Normal View History

2021-07-12 21:26:53 -05:00
import "@fluencelabs/aqua-lib/builtin.aqua"
2021-07-11 23:21:01 -05:00
service OpTS("op"):
identity(s: u64)
2021-07-12 21:26:53 -05:00
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)
2021-07-11 23:21:01 -05:00
on node:
k <- Op.string_to_b58(node)
2021-07-12 21:26:53 -05:00
nodes <- Kademlia.neighborhood(k, none_bool, nsize)
2021-07-11 23:21:01 -05:00
for n <- nodes par:
on n:
try:
res <- Peer.timestamp_ms()
OpTS.identity(res!9)
<- res