From 39b8184f575c329936d0dca99dc0c0d87138e5fe Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Fri, 14 Nov 2025 18:56:24 +0800 Subject: [PATCH] XDPoS/utils: must use `NewPool()` to create Pool, close XFN-13 (#1667) --- consensus/XDPoS/utils/pool.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/consensus/XDPoS/utils/pool.go b/consensus/XDPoS/utils/pool.go index c2d177a068..399db859e8 100644 --- a/consensus/XDPoS/utils/pool.go +++ b/consensus/XDPoS/utils/pool.go @@ -12,6 +12,8 @@ type PoolObj interface { GetSigner() common.Address DeepCopy() interface{} } + +// Note: must use `NewPool()` to create `Pool` since field `objList` is a map type Pool struct { objList map[string]map[common.Hash]PoolObj lock sync.RWMutex // Protects the pool fields @@ -22,6 +24,7 @@ func NewPool() *Pool { objList: make(map[string]map[common.Hash]PoolObj), } } + func (p *Pool) Get() map[string]map[common.Hash]PoolObj { p.lock.RLock() defer p.lock.RUnlock()