MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / updateHashfield

Method updateHashfield

src/Peer/Peer.py:306–317  ·  view source on GitHub ↗
(self, force=False)

Source from the content-addressed store, hash-verified

304 return self.request("listModified", {"since": since, "site": self.site.address})
305
306 def updateHashfield(self, force=False):
307 # Don't update hashfield again in 5 min
308 if self.time_hashfield and time.time() - self.time_hashfield < 5 * 60 and not force:
309 return False
310
311 self.time_hashfield = time.time()
312 res = self.request("getHashfield", {"site": self.site.address})
313 if not res or "error" in res or "hashfield_raw" not in res:
314 return False
315 self.hashfield.replaceFromBytes(res["hashfield_raw"])
316
317 return self.hashfield
318
319 # Find peers for hashids
320 # Return: {hash1: ["ip:port", "ip:port",...],...}

Callers

nothing calls this directly

Calls 2

requestMethod · 0.95
replaceFromBytesMethod · 0.80

Tested by

no test coverage detected