(data)
| 458 | objectProcessorQueue.put((objectType,data)) |
| 459 | |
| 460 | def _checkAndSharePubkeyWithPeers(data): |
| 461 | if len(data) < 146 or len(data) > 440: # sanity check |
| 462 | return |
| 463 | embeddedTime, = unpack('>Q', data[8:16]) |
| 464 | readPosition = 20 # bypass the nonce, time, and object type |
| 465 | addressVersion, varintLength = decodeVarint( |
| 466 | data[readPosition:readPosition + 10]) |
| 467 | readPosition += varintLength |
| 468 | streamNumber, varintLength = decodeVarint( |
| 469 | data[readPosition:readPosition + 10]) |
| 470 | readPosition += varintLength |
| 471 | if not streamNumber in state.streamsInWhichIAmParticipating: |
| 472 | logger.debug('The streamNumber %s isn\'t one we are interested in.' % streamNumber) |
| 473 | return |
| 474 | if addressVersion >= 4: |
| 475 | tag = data[readPosition:readPosition + 32] |
| 476 | logger.debug('tag in received pubkey is: %s' % hexlify(tag)) |
| 477 | else: |
| 478 | tag = '' |
| 479 | |
| 480 | inventoryHash = calculateInventoryHash(data) |
| 481 | if inventoryHash in Inventory(): |
| 482 | logger.debug('We have already received this pubkey. Ignoring it.') |
| 483 | return |
| 484 | objectType = 1 |
| 485 | Inventory()[inventoryHash] = ( |
| 486 | objectType, streamNumber, data, embeddedTime, tag) |
| 487 | # This object is valid. Forward it to peers. |
| 488 | logger.debug('advertising inv with hash: %s' % hexlify(inventoryHash)) |
| 489 | protocol.broadcastToSendDataQueues((streamNumber, 'advertiseobject', inventoryHash)) |
| 490 | |
| 491 | |
| 492 | # Now let's queue it to be processed ourselves. |
| 493 | objectProcessorQueue.put((objectType,data)) |
| 494 | |
| 495 | |
| 496 | def _checkAndShareBroadcastWithPeers(data): |
no test coverage detected