MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / bm_command_getdata

Method bm_command_getdata

src/network/bmproto.py:275–297  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

273 return True
274
275 def bm_command_getdata(self):
276 items = self.decode_payload_content("l32s")
277 # skip?
278 if time.time() < self.skipUntil:
279 return True
280 #TODO make this more asynchronous
281 random.shuffle(items)
282 for i in map(str, items):
283 if Dandelion().hasHash(i) and \
284 self != Dandelion().objectChildStem(i):
285 self.antiIntersectionDelay()
286 logger.info('%s asked for a stem object we didn\'t offer to it.&#x27;, self.destination)
287 break
288 else:
289 try:
290 self.append_write_buf(protocol.CreatePacket('object', Inventory()[i].payload))
291 except KeyError:
292 self.antiIntersectionDelay()
293 logger.info('%s asked for an object we don\'t have.&#x27;, self.destination)
294 break
295 # I think that aborting after the first missing/stem object is more secure
296 # when using random reordering, as the recipient won't know exactly which objects we refuse to deliver
297 return True
298
299 def _command_inv(self, dandelion=False):
300 items = self.decode_payload_content("l32s")

Callers

nothing calls this directly

Calls 7

DandelionClass · 0.90
InventoryClass · 0.90
objectChildStemMethod · 0.80
append_write_bufMethod · 0.80
hasHashMethod · 0.45
antiIntersectionDelayMethod · 0.45

Tested by

no test coverage detected