+ /**
+ * Determines private key hash from given session id
+ *
+ * @param $decodedData Array with decoded data
+ * @return $hash Private key's hash
+ */
+ private function determineSenderPrivateKeyHash (array $decodedData) {
+ // Get DHT instance
+ $dhtInstance = DhtObjectFactory::createDhtInstance('node');
+
+ // Ask DHT for session id
+ $senderData = $dhtInstance->findNodeLocalBySessionId($decodedData[self::PACKAGE_CONTENT_SENDER]);
+
+ // Is an entry found?
+ if (count($senderData) > 0) {
+ // Make sure the element 'private_key_hash' is there
+ /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: senderData=' . print_r($senderData, TRUE));
+ assert(isset($senderData[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_PRIVATE_KEY_HASH]));
+
+ // Return it
+ return $senderData[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_PRIVATE_KEY_HASH];
+ } // END - if
+
+ // Make sure the requested element is there
+ //* DEBUG-DIE */ die('decodedData=' . print_r($decodedData, TRUE));
+ assert(isset($decodedData[self::PACKAGE_CONTENT_PRIVATE_KEY_HASH]));
+
+ // There is no DHT entry so, accept the hash from decoded data
+ return $decodedData[self::PACKAGE_CONTENT_PRIVATE_KEY_HASH];
+ }
+