(data)
| 462 | objectProcessorQueue.put((objectType,data)) |
| 463 | |
| 464 | def _checkAndShareGetpubkeyWithPeers(data): |
| 465 | if len(data) < 42: |
| 466 | logger.info('getpubkey message doesn\'t contain enough data. Ignoring.') |
| 467 | return |
| 468 | if len(data) > 200: |
| 469 | logger.info('getpubkey is abnormally long. Sanity check failed. Ignoring object.') |
| 470 | embeddedTime, = unpack('>Q', data[8:16]) |
| 471 | readPosition = 20 # bypass the nonce, time, and object type |
| 472 | requestedAddressVersionNumber, addressVersionLength = decodeVarint( |
| 473 | data[readPosition:readPosition + 10]) |
| 474 | readPosition += addressVersionLength |
| 475 | streamNumber, streamNumberLength = decodeVarint( |
| 476 | data[readPosition:readPosition + 10]) |
| 477 | if not streamNumber in state.streamsInWhichIAmParticipating: |
| 478 | logger.debug('The streamNumber %s isn\'t one we are interested in.', streamNumber) |
| 479 | return |
| 480 | readPosition += streamNumberLength |
| 481 | |
| 482 | inventoryHash = calculateInventoryHash(data) |
| 483 | if inventoryHash in Inventory(): |
| 484 | logger.debug('We have already received this getpubkey request. Ignoring it.') |
| 485 | return |
| 486 | |
| 487 | objectType = 0 |
| 488 | Inventory()[inventoryHash] = ( |
| 489 | objectType, streamNumber, data, embeddedTime,'') |
| 490 | # This getpubkey request is valid. Forward to peers. |
| 491 | logger.debug('advertising inv with hash: %s', hexlify(inventoryHash)) |
| 492 | broadcastToSendDataQueues((streamNumber, 'advertiseobject', inventoryHash)) |
| 493 | |
| 494 | # Now let's queue it to be processed ourselves. |
| 495 | objectProcessorQueue.put((objectType,data)) |
| 496 | |
| 497 | def _checkAndSharePubkeyWithPeers(data): |
| 498 | if len(data) < 146 or len(data) > 440: # sanity check |
no test coverage detected