From 41b1bebb9ea18a46194ff16e4664b78ae5ad86e9 Mon Sep 17 00:00:00 2001 From: nk_ysg Date: Mon, 7 Apr 2025 12:44:19 +0800 Subject: [PATCH] update Router::SupportChainId use go map ok idioms --- utils/core/router.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/utils/core/router.go b/utils/core/router.go index c246e0a..df430fd 100644 --- a/utils/core/router.go +++ b/utils/core/router.go @@ -50,12 +50,8 @@ func (r *Router) SupportChainId(chainId msg.ChainId) bool { r.lock.Lock() defer r.lock.Unlock() - w := r.registry[chainId] - if w == nil { - return false - } else { - return true - } + _, exists := r.registry[chainId] + return exists } // Listen registers a Writer with a ChainId which Router.Send can then use to propagate messages