(self)
| 413 | self.sendBigInv() |
| 414 | |
| 415 | def sendBigInv(self): |
| 416 | # Select all hashes for objects in this stream. |
| 417 | bigInvList = {} |
| 418 | for stream in self.streamNumber: |
| 419 | for hash in Inventory().unexpired_hashes_by_stream(stream): |
| 420 | if not self.objectHashHolderInstance.hasHash(hash): |
| 421 | bigInvList[hash] = 0 |
| 422 | numberOfObjectsInInvMessage = 0 |
| 423 | payload = '' |
| 424 | # Now let us start appending all of these hashes together. They will be |
| 425 | # sent out in a big inv message to our new peer. |
| 426 | for hash, storedValue in bigInvList.items(): |
| 427 | payload += hash |
| 428 | numberOfObjectsInInvMessage += 1 |
| 429 | if numberOfObjectsInInvMessage == 50000: # We can only send a max of 50000 items per inv message but we may have more objects to advertise. They must be split up into multiple inv messages. |
| 430 | self.sendinvMessageToJustThisOnePeer( |
| 431 | numberOfObjectsInInvMessage, payload) |
| 432 | payload = '' |
| 433 | numberOfObjectsInInvMessage = 0 |
| 434 | if numberOfObjectsInInvMessage > 0: |
| 435 | self.sendinvMessageToJustThisOnePeer( |
| 436 | numberOfObjectsInInvMessage, payload) |
| 437 | |
| 438 | # Used to send a big inv message when the connection with a node is |
| 439 | # first fully established. Notice that there is also a broadcastinv |
no test coverage detected