From f11346c03afd5efd3fa4c511ff964b6136bb86c1 Mon Sep 17 00:00:00 2001 From: Ethan Date: Wed, 24 Jul 2024 15:07:20 +0800 Subject: [PATCH] fix: not set agentToOperator while newAgent is zero address (#579) --- contracts/BC_fusion/StakeHub.sol | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contracts/BC_fusion/StakeHub.sol b/contracts/BC_fusion/StakeHub.sol index 587b6749..9f8ba670 100644 --- a/contracts/BC_fusion/StakeHub.sol +++ b/contracts/BC_fusion/StakeHub.sol @@ -341,7 +341,10 @@ contract StakeHub is System, Initializable, Protectable { } _validators[operatorAddress].agent = newAgent; - agentToOperator[newAgent] = operatorAddress; + + if (newAgent != address(0)) { + agentToOperator[newAgent] = operatorAddress; + } emit AgentChanged(operatorAddress, oldAgent, newAgent); }