MCPcopy Create free account
hub / github.com/ElementsProject/elements / on_getdata

Method on_getdata

test/functional/test_framework/p2p.py:656–665  ·  view source on GitHub ↗

Check for the tx/block in our stores and if found, reply with an inv message.

(self, message)

Source from the content-addressed store, hash-verified

654 self.getdata_requests = []
655
656 def on_getdata(self, message):
657 """Check for the tx/block in our stores and if found, reply with an inv message."""
658 for inv in message.inv:
659 self.getdata_requests.append(inv.hash)
660 if (inv.type & MSG_TYPE_MASK) == MSG_TX and inv.hash in self.tx_store.keys():
661 self.send_message(msg_tx(self.tx_store[inv.hash]))
662 elif (inv.type & MSG_TYPE_MASK) == MSG_BLOCK and inv.hash in self.block_store.keys():
663 self.send_message(msg_block(self.block_store[inv.hash]))
664 else:
665 logger.debug('getdata message type {} received.'.format(hex(inv.type)))
666
667 def on_getheaders(self, message):
668 """Search back through our block store for the locator, and reply with a headers message if found."""

Callers

nothing calls this directly

Calls 4

msg_txClass · 0.90
msg_blockClass · 0.90
formatMethod · 0.80
send_messageMethod · 0.45

Tested by

no test coverage detected