From 475530c14b68288998d29cba41dba059fbd234f0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 6 Nov 2020 14:18:28 +0100 Subject: [PATCH] Continued: - also here, the senderId is required already MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../handler/package/class_NetworkPackageHandler.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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())); -- 2.39.5