From: Roland Häder Date: Fri, 6 Nov 2020 13:18:28 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=475530c14b68288998d29cba41dba059fbd234f0;p=hub.git Continued: - also here, the senderId is required already Signed-off-by: Roland Häder --- diff --git a/application/hub/classes/handler/package/class_NetworkPackageHandler.php b/application/hub/classes/handler/package/class_NetworkPackageHandler.php index 1d8e38461..fd77d7e57 100644 --- a/application/hub/classes/handler/package/class_NetworkPackageHandler.php +++ b/application/hub/classes/handler/package/class_NetworkPackageHandler.php @@ -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()));