*
* @param $decodedData Array with decoded data
* @return $hash Private key's hash
+ * @throws InvalidPrivateKeyHashException If the private key's hash is not valid
*/
private function determineSenderPrivateKeyHash (array $decodedData) {
// Get DHT instance
//* NOISY-DEBUG */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: senderData=' . print_r($senderData, TRUE));
assert(isset($senderData[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_PRIVATE_KEY_HASH]));
+ // Don't accept empty hashes
+ if (empty($senderData[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_PRIVATE_KEY_HASH])) {
+ // Don't accept
+ throw new InvalidPrivateKeyHashException(array($this, $senderData, 'empty hash in senderData'), self::EXCEPTION_INVALID_PRIVATE_KEY_HASH);
+ } // END - if
+
// Return it
return $senderData[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_PRIVATE_KEY_HASH];
} // END - if
// Don't accept empty keys
if (empty($decodedData[self::PACKAGE_CONTENT_PRIVATE_KEY_HASH])) {
// This needs fixing
- die('[' . __METHOD__ . ':' . __LINE__ . ':] Empty private key hash: decodedData=' . print_r($decodedData, TRUE));
+ throw new InvalidPrivateKeyHashException(array($this, $senderData, 'empty hash in decodedData'), self::EXCEPTION_INVALID_PRIVATE_KEY_HASH);
} // END - if
// There is no DHT entry so, accept the hash from decoded data