MCPcopy Create free account
hub / github.com/Bitmessage/PyBitmessage / assembleAddr

Method assembleAddr

src/network/bmproto.py:521–539  ·  view source on GitHub ↗
(peerList)

Source from the content-addressed store, hash-verified

519
520 @staticmethod
521 def assembleAddr(peerList):
522 if isinstance(peerList, state.Peer):
523 peerList = (peerList)
524 if not peerList:
525 return b''
526 retval = b''
527 for i in range(0, len(peerList), BMProto.maxAddrCount):
528 payload = addresses.encodeVarint(len(peerList[i:i + BMProto.maxAddrCount]))
529 for address in peerList[i:i + BMProto.maxAddrCount]:
530 stream, peer, timestamp = address
531 payload += struct.pack(
532 '>Q', timestamp) # 64-bit time
533 payload += struct.pack('>I', stream)
534 payload += struct.pack(
535 '>q', 1) # service bit flags offered by this node
536 payload += protocol.encodeHost(peer.host)
537 payload += struct.pack('>H', peer.port) # remote port
538 retval += protocol.CreatePacket('addr', payload)
539 return retval
540
541 @staticmethod
542 def stopDownloadingObject(hashId, forwardAnyway=False):

Callers 2

announceSelfMethod · 0.80
sendAddrMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected