From 73ec3ac0d0c1c9804861c7b7d232087f3479b16d Mon Sep 17 00:00:00 2001 From: Adamantios Date: Wed, 15 Nov 2023 12:38:44 +0200 Subject: [PATCH] fix: use the correct param for the service id and check None --- .../valory/skills/staking_abci/behaviours.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/valory/skills/staking_abci/behaviours.py b/packages/valory/skills/staking_abci/behaviours.py index 4ab4f4fde..09b3c67c2 100644 --- a/packages/valory/skills/staking_abci/behaviours.py +++ b/packages/valory/skills/staking_abci/behaviours.py @@ -229,13 +229,21 @@ def _check_service_staked(self) -> WaitableConditionType: """Check whether the service is staked.""" if self.synchronized_data.period_count != 0: self.is_service_staked = self.synchronized_data.is_service_staked - status = True - else: - status = yield from self._staking_contract_interact( - contract_callable="is_service_staked", - placeholder=get_name(CallCheckpointBehaviour.is_service_staked), - service_id=self.params.service_id, + return True + + service_id = self.params.on_chain_service_id + if service_id is None: + self.context.logger.warning( + "Cannot perform any staking-related operations without a configured on-chain service id. " + "Setting status to 'not staked'." ) + return True + + status = yield from self._staking_contract_interact( + contract_callable="is_service_staked", + placeholder=get_name(CallCheckpointBehaviour.is_service_staked), + service_id=service_id, + ) return status