From e52119f3597a6b341405c0a6afc7e6760cf88f2c Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Thu, 26 Aug 2021 15:17:11 +0700 Subject: [PATCH] try drop in-mem buf after flush --- txpool/pool.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/txpool/pool.go b/txpool/pool.go index 7f5e3891a..11cefabab 100644 --- a/txpool/pool.go +++ b/txpool/pool.go @@ -515,8 +515,8 @@ var PoolPendingBaseFeeKey = []byte("pending_base_fee") var PoolProtocolBaseFeeKey = []byte("protocol_base_fee") func (sc *SendersCache) flush(tx kv.RwTx) error { - sc.lock.RLock() - defer sc.lock.RUnlock() + sc.lock.Lock() + defer sc.lock.Unlock() encID := make([]byte, 8) for addr, id := range sc.senderIDs { binary.BigEndian.PutUint64(encID, id) @@ -553,7 +553,7 @@ func (sc *SendersCache) flush(tx kv.RwTx) error { return err } } - sc.senderIDs = map[string]uint64{} + sc.senderInfo = map[uint64]*senderInfo{} binary.BigEndian.PutUint64(encID, sc.blockHeight.Load()) if err := tx.Put(kv.PoolInfo, SenderCacheHeightKey, encID); err != nil {