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

Method possibleNewPubkey

src/class_objectProcessor.py:801–825  ·  view source on GitHub ↗

We have inserted a pubkey into our pubkey table which we received from a pubkey, msg, or broadcast message. It might be one that we have been waiting for. Let's check.

(self, address)

Source from the content-addressed store, hash-verified

799
800
801 def possibleNewPubkey(self, address):
802 """
803 We have inserted a pubkey into our pubkey table which we received from a
804 pubkey, msg, or broadcast message. It might be one that we have been
805 waiting for. Let's check.
806 """
807
808 # For address versions <= 3, we wait on a key with the correct address version,
809 # stream number, and RIPE hash.
810 status, addressVersion, streamNumber, ripe = decodeAddress(address)
811 if addressVersion <=3:
812 if address in state.neededPubkeys:
813 del state.neededPubkeys[address]
814 self.sendMessages(address)
815 else:
816 logger.debug('We don\'t need this pub key. We didn\'t ask for it. For address: %s' % address)
817 # For address versions >= 4, we wait on a pubkey with the correct tag.
818 # Let us create the tag from the address and see if we were waiting
819 # for it.
820 elif addressVersion >= 4:
821 tag = hashlib.sha512(hashlib.sha512(encodeVarint(
822 addressVersion) + encodeVarint(streamNumber) + ripe).digest()).digest()[32:]
823 if tag in state.neededPubkeys:
824 del state.neededPubkeys[tag]
825 self.sendMessages(address)
826
827 def sendMessages(self, address):
828 """

Callers 3

processpubkeyMethod · 0.95
processmsgMethod · 0.95
processbroadcastMethod · 0.95

Calls 3

sendMessagesMethod · 0.95
decodeAddressFunction · 0.85
encodeVarintFunction · 0.85

Tested by

no test coverage detected