From e315badcfe3b2d66a41472b994508a050f3f5f38 Mon Sep 17 00:00:00 2001 From: romever <360876221@qq.com> Date: Tue, 6 Aug 2024 03:22:45 +0800 Subject: [PATCH] fix: validator info api: runtimes status. --- api/internal/logic/validator/validatorinfologic.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/internal/logic/validator/validatorinfologic.go b/api/internal/logic/validator/validatorinfologic.go index 8019ee0..112dfeb 100644 --- a/api/internal/logic/validator/validatorinfologic.go +++ b/api/internal/logic/validator/validatorinfologic.go @@ -196,6 +196,7 @@ func (l *ValidatorInfoLogic) ValidatorInfo(req *types.ValidatorInfoRequest) (res Online: false, }) } + runtimeMap := make(map[string]bool, 0) for _, validatorNode := range validatorNodes { var pubKey signature.PublicKey err = pubKey.UnmarshalText([]byte(validatorNode.NodeId)) @@ -211,13 +212,12 @@ func (l *ValidatorInfoLogic) ValidatorInfo(req *types.ValidatorInfoRequest) (res if !strings.Contains(node.Roles.String(), "compute") { continue } - runtimeMap := make(map[string]bool, 0) for _, runtime := range node.Runtimes { runtimeMap[runtime.ID.Hex()] = true } - for _, validatorRuntime := range validatorRuntimes { - validatorRuntime.Online = runtimeMap[validatorRuntime.Id] - } + } + for _, validatorRuntime := range validatorRuntimes { + validatorRuntime.Online = runtimeMap[validatorRuntime.Id] } validatorInfo.Runtimes = validatorRuntimes