try drop in-mem buf after flush

This commit is contained in:
alex.sharov 2021-08-26 15:17:11 +07:00
parent 677c0169aa
commit e52119f359

View File

@ -515,8 +515,8 @@ var PoolPendingBaseFeeKey = []byte("pending_base_fee")
var PoolProtocolBaseFeeKey = []byte("protocol_base_fee") var PoolProtocolBaseFeeKey = []byte("protocol_base_fee")
func (sc *SendersCache) flush(tx kv.RwTx) error { func (sc *SendersCache) flush(tx kv.RwTx) error {
sc.lock.RLock() sc.lock.Lock()
defer sc.lock.RUnlock() defer sc.lock.Unlock()
encID := make([]byte, 8) encID := make([]byte, 8)
for addr, id := range sc.senderIDs { for addr, id := range sc.senderIDs {
binary.BigEndian.PutUint64(encID, id) binary.BigEndian.PutUint64(encID, id)
@ -553,7 +553,7 @@ func (sc *SendersCache) flush(tx kv.RwTx) error {
return err return err
} }
} }
sc.senderIDs = map[string]uint64{} sc.senderInfo = map[uint64]*senderInfo{}
binary.BigEndian.PutUint64(encID, sc.blockHeight.Load()) binary.BigEndian.PutUint64(encID, sc.blockHeight.Load())
if err := tx.Put(kv.PoolInfo, SenderCacheHeightKey, encID); err != nil { if err := tx.Put(kv.PoolInfo, SenderCacheHeightKey, encID); err != nil {