]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/package/class_NetworkPackage.php
'scrypt' is better now a "feature" which needs to be tested and enabled in a pre...
[hub.git] / application / hub / main / package / class_NetworkPackage.php
index de863f1213c7a1a4fdf56664ee62850b521f5be6..c0e01cffba2abb5341e3db43d29a81ec9aae6ba7 100644 (file)
@@ -653,9 +653,15 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
         *
         * @param       $content        Raw package data
         * @param       $senderId       Sender id to generate a hash for
-        * @return      $hash   Hash as hex-encoded string
+        * @return      $hash           Hash as hex-encoded string
         */
        private function generatePackageHash ($content, $senderId) {
+               // Is the feature enabled?
+               if ($this->getConfigInstance()->getConfigEntry('extension_scrypt_loaded') === FALSE) {
+                       // Feature is not enabled
+                       return NULL;
+               } // END - if
+
                // Fake array
                $data = array(
                        self::PACKAGE_CONTENT_SENDER           => $senderId,
@@ -680,6 +686,12 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
         * @todo        Unfinished area, hashes are currently NOT fully supported
         */
        private function isPackageHashValid (array $decodedArray) {
+               // Is the feature enabled?
+               if ($this->getConfigInstance()->getConfigEntry('extension_scrypt_loaded') === FALSE) {
+                       // Feature is not enabled, so hashes are always valid
+                       return TRUE;
+               } // END - if
+
                // Check validity
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: senderId=' . $decodedArray[self::PACKAGE_CONTENT_SENDER] . ',decodedArray=' . print_r($decodedArray, TRUE));
                //* DEBUG-DIE: */ die(__METHOD__ . ': decodedArray=' . print_r($decodedArray, TRUE));
@@ -1414,6 +1426,15 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
         * @todo        ~10% done?
         */
        public function feedHashToMiner (array $messageData) {
+               // Is the feature enabled?
+               if ($this->getConfigInstance()->getConfigEntry('extension_scrypt_loaded') === FALSE) {
+                       /*
+                        * Feature is not enabled, don't feed the hash to the miner as it
+                        *may be invalid.
+                        */
+                       return;
+               } // END - if
+
                // Make sure the required elements are there
                assert(isset($messageData[self::MESSAGE_ARRAY_SENDER]));
                assert(isset($messageData[self::MESSAGE_ARRAY_HASH]));