]> git.mxchange.org Git - hub.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Fri, 6 Nov 2020 13:18:28 +0000 (14:18 +0100)
committerRoland Häder <roland@mxchange.org>
Fri, 6 Nov 2020 13:18:28 +0000 (14:18 +0100)
- also here, the senderId is required already

Signed-off-by: Roland Häder <roland@mxchange.org>
application/hub/classes/handler/package/class_NetworkPackageHandler.php

index 1d8e38461a7046ec20659512a2b9c5a7e5553505..fd77d7e57208a85cba0f987f1eee8c83645c2d70 100644 (file)
@@ -764,7 +764,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
         *
         * @param       $packageInstance        An instance of a DeliverablePackage class
         * @return      $isHashValid    Whether the hash is valid
-        * @todo        Unfinished area, hashes are currently NOT fully supported
+        * @throws      InvalidArgumentException        If $packageInstance contains no senderId
         */
        private function isPackageHashValid (DeliverablePackage $packageInstance) {
                // Is the feature enabled?
@@ -773,7 +773,10 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                        // Feature is not enabled, so hashes are always valid
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: Feature "hubcoin_reward" not available, not checking hash. Returning TRUE ...');
                        return TRUE;
-               } // END - if
+               } elseif ($packageInstance->getSenderId() == '') {
+                       // Invalid $packageInstance
+                       throw new InvalidArgumentException('packageInstance does not contain senderId');
+               }
 
                // Check validity
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: packageInstance->senderId=%s,packageInstance->packageContent=%s,packageInstance->contentHash=%s', $packageInstance->getSenderId(), $packageInstance->getPackageContent(), $packageInstance->getContentHash()));