(data)
| 427 | objectProcessorQueue.put((objectType,data)) |
| 428 | |
| 429 | def _checkAndShareGetpubkeyWithPeers(data): |
| 430 | if len(data) < 42: |
| 431 | logger.info('getpubkey message doesn\'t contain enough data. Ignoring.') |
| 432 | return |
| 433 | embeddedTime, = unpack('>Q', data[8:16]) |
| 434 | readPosition = 20 # bypass the nonce, time, and object type |
| 435 | requestedAddressVersionNumber, addressVersionLength = decodeVarint( |
| 436 | data[readPosition:readPosition + 10]) |
| 437 | readPosition += addressVersionLength |
| 438 | streamNumber, streamNumberLength = decodeVarint( |
| 439 | data[readPosition:readPosition + 10]) |
| 440 | if not streamNumber in state.streamsInWhichIAmParticipating: |
| 441 | logger.debug('The streamNumber %s isn\'t one we are interested in.' % streamNumber) |
| 442 | return |
| 443 | readPosition += streamNumberLength |
| 444 | |
| 445 | inventoryHash = calculateInventoryHash(data) |
| 446 | if inventoryHash in Inventory(): |
| 447 | logger.debug('We have already received this getpubkey request. Ignoring it.') |
| 448 | return |
| 449 | |
| 450 | objectType = 0 |
| 451 | Inventory()[inventoryHash] = ( |
| 452 | objectType, streamNumber, data, embeddedTime,'') |
| 453 | # This getpubkey request is valid. Forward to peers. |
| 454 | logger.debug('advertising inv with hash: %s' % hexlify(inventoryHash)) |
| 455 | protocol.broadcastToSendDataQueues((streamNumber, 'advertiseobject', inventoryHash)) |
| 456 | |
| 457 | # Now let's queue it to be processed ourselves. |
| 458 | objectProcessorQueue.put((objectType,data)) |
| 459 | |
| 460 | def _checkAndSharePubkeyWithPeers(data): |
| 461 | if len(data) < 146 or len(data) > 440: # sanity check |
no test coverage detected