mirror of
https://github.com/logos-storage/logos-storage-network-crawler.git
synced 2026-01-09 17:03:12 +00:00
Sets secp256k1 key scheme
This commit is contained in:
parent
4d5f204f60
commit
29f4c3e80f
@ -19,9 +19,10 @@ requires "libp2p == 1.5.0"
|
||||
requires "metrics#cacfdc12454a0804c65112b9f4f50d1375208dcd"
|
||||
requires "stew >= 0.2.0"
|
||||
requires "stint#3236fa68394f1e3a06e2bc34218aacdd2d675923"
|
||||
requires "https://github.com/codex-storage/nim-datastore >= 0.1.0 & < 0.2.0"
|
||||
requires "https://github.com/codex-storage/nim-datastore#b5635ef82f50255bc5ff2fe411722d870bcb587c"
|
||||
requires "questionable >= 0.10.15 & < 0.11.0"
|
||||
requires "https://github.com/codex-storage/nim-codex-dht#4bd3a39e0030f8ee269ef217344b6b59ec2be6dc"
|
||||
|
||||
# 7 Jan 2024 - Support for Nim 2.0.14
|
||||
requires "docopt >= 0.7.1 & < 1.0.0"
|
||||
requires "nph >= 0.6.1 & < 1.0.0"
|
||||
|
||||
@ -41,21 +41,24 @@ proc getNode*(d: Dht, nodeId: NodeId): ?!Node =
|
||||
return failure("Node not found for id: " & $nodeId)
|
||||
|
||||
proc hacky*(d: Dht, nodeId: NodeId) {.async.} =
|
||||
let node = await d.protocol.resolve(nodeId)
|
||||
await sleepAsync(1)
|
||||
let node = d.protocol.getNode(nodeId)
|
||||
if node.isSome():
|
||||
info "that worked"
|
||||
let n = node.get()
|
||||
info "that worked", node = $n.id, seen = $n.seen
|
||||
else:
|
||||
info "that didn't work"
|
||||
info "that didn't work", node = $nodeId
|
||||
|
||||
proc getRoutingTableNodeIds*(d: Dht): Future[seq[NodeId]] {.async.} =
|
||||
var ids = newSeq[NodeId]()
|
||||
info "routing table", len = $d.protocol.routingTable.len
|
||||
for bucket in d.protocol.routingTable.buckets:
|
||||
for node in bucket.nodes:
|
||||
warn "node seen", node = $node.id, seen = $node.seen
|
||||
ids.add(node.id)
|
||||
|
||||
# await d.hacky(node.id)
|
||||
await sleepAsync(1)
|
||||
await d.hacky(node.id)
|
||||
# await sleepAsync(1)
|
||||
return ids
|
||||
|
||||
proc getDistances(): seq[uint16] =
|
||||
|
||||
@ -50,7 +50,7 @@ proc setupKey*(path: string): ?!PrivateKey =
|
||||
if not path.fileAccessible({AccessFlags.Find}):
|
||||
info "Creating a private key and saving it"
|
||||
let
|
||||
res = ?PrivateKey.random(Rng.instance()[]).mapFailure(KeyError)
|
||||
res = ?PrivateKey.random(PKScheme.Secp256k1, Rng.instance()[]).mapFailure(KeyError)
|
||||
bytes = ?res.getBytes().mapFailure(KeyError)
|
||||
|
||||
?path.secureWriteFile(bytes).mapFailure(KeyError)
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
--define:
|
||||
metrics
|
||||
|
||||
switch("define", "libp2p_pki_schemes=secp256k1")
|
||||
|
||||
# switch("define", "chronicles_runtime_filtering=true")
|
||||
# Sets TRACE logging for everything except DHT
|
||||
switch("define", "chronicles_log_level=INFO")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user