]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/package/class_NetworkPackage.php
Updated to latest 'core' + convertToClassName() and convertDashesToUnderscores()...
[hub.git] / application / hub / main / package / class_NetworkPackage.php
index 9b474be5ec9192d2881fc0735e78346b3e486da6..df534cd3ac01a7c8131d5537e538b26792dc0547 100644 (file)
@@ -657,10 +657,10 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
         */
        private function generatePackageHash ($content, $senderId) {
                // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: extension_scrypt_loaded=' . intval($this->getConfigInstance()->getConfigEntry('extension_scrypt_loaded')) . ' - CALLED!');
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: isFeatureAvailable(hubcoin_reward)=' . intval(FrameworkFeature::isFeatureAvailable('hubcoin_reward')) . ' - CALLED!');
 
                // Is the feature enabled?
-               if ($this->getConfigInstance()->getConfigEntry('extension_scrypt_loaded') === FALSE) {
+               if (!FrameworkFeature::isFeatureAvailable('hubcoin_reward')) {
                        // Feature is not enabled
                        return NULL;
                } // END - if
@@ -674,7 +674,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
        
                // Hash content and sender id together, use scrypt
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: senderId=' . $senderId . ',content()=' . strlen($content));
-               $hash = Scrypt::hashScrypt($senderId . ':' . $content . ':' . $this->determineSenderPrivateKeyHash($data));
+               $hash = FrameworkFeature::callFeature('hubcoin_reward', 'generateHash', array($senderId . ':' . $content . ':' . $this->determineSenderPrivateKeyHash($data)));
 
                // Debug message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: hash=' . $hash . ' - EXIT!');
@@ -693,7 +693,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
         */
        private function isPackageHashValid (array $decodedArray) {
                // Is the feature enabled?
-               if ($this->getConfigInstance()->getConfigEntry('extension_scrypt_loaded') === FALSE) {
+               if (!FrameworkFeature::isFeatureAvailable('hubcoin_reward')) {
                        // Feature is not enabled, so hashes are always valid
                        return TRUE;
                } // END - if
@@ -701,7 +701,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
                // 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));
-               $isHashValid = Scrypt::checkScrypt($decodedArray[self::PACKAGE_CONTENT_SENDER] . ':' . $decodedArray[self::PACKAGE_CONTENT_MESSAGE] . ':' . $this->determineSenderPrivateKeyHash($decodedArray), $decodedArray[self::PACKAGE_CONTENT_HASH]);
+               $isHashValid = FrameworkFeature::callFeature('hubcoin_reward', 'checkHash', array($decodedArray[self::PACKAGE_CONTENT_SENDER] . ':' . $decodedArray[self::PACKAGE_CONTENT_MESSAGE] . ':' . $this->determineSenderPrivateKeyHash($decodedArray), $decodedArray[self::PACKAGE_CONTENT_HASH]));
 
                // Return it
                //* DEBUG-DIE: */ die(__METHOD__ . ': isHashValid=' . intval($isHashValid) . ',decodedArray=' . print_r($decodedArray, TRUE));
@@ -1425,7 +1425,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
         * Feeds the hash and sender (as recipient for the 'sender' reward) to the
         * miner's queue, unless the message is not a "reward claim" message as this
         * leads to an endless loop. You may wish to run the miner to get some
-        * reward ("HubCoins") for "mining" this hash.
+        * reward ("Hubcoins") for "mining" this hash.
         *
         * @param       $messageData    Array with message data
         * @return      void
@@ -1433,7 +1433,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
         */
        public function feedHashToMiner (array $messageData) {
                // Is the feature enabled?
-               if ($this->getConfigInstance()->getConfigEntry('extension_scrypt_loaded') === FALSE) {
+               if (!FrameworkFeature::isFeatureAvailable('hubcoin_reward')) {
                        /*
                         * Feature is not enabled, don't feed the hash to the miner as it
                         *may be invalid.