mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-08 12:01:20 +00:00
add state check assert routine
This commit is contained in:
parent
d4cf078cfc
commit
e7572f6082
@ -563,18 +563,21 @@ func (sc *SendersCache) flush(tx kv.RwTx, byNonce *ByNonce, sendersWithoutTransa
|
|||||||
|
|
||||||
encID := make([]byte, 8)
|
encID := make([]byte, 8)
|
||||||
encIDs := make([]byte, 0, 8*len(sendersWithoutTransactions))
|
encIDs := make([]byte, 0, 8*len(sendersWithoutTransactions))
|
||||||
// Eviction logic. store into db list of senders:
|
// Eviction logic. Store into db list of senders:
|
||||||
// - which have discarded transactions at this commit
|
// - which have discarded transactions at this commit
|
||||||
// - but have no active transactions left
|
// - but have no active transactions left
|
||||||
// after some time read this senders from DB and if they still have no transactions - evict them
|
// after some time read old records from DB and if such senders still have no transactions - evict them
|
||||||
for id := range sendersWithoutTransactions {
|
for id := range sendersWithoutTransactions {
|
||||||
binary.BigEndian.PutUint64(encID, id)
|
binary.BigEndian.PutUint64(encID, id)
|
||||||
encIDs = append(encIDs, encID...)
|
encIDs = append(encIDs, encID...)
|
||||||
binary.BigEndian.PutUint64(encID, sc.commitID)
|
binary.BigEndian.PutUint64(encID, sc.commitID)
|
||||||
|
}
|
||||||
|
if len(encIDs) > 0 {
|
||||||
if err := tx.Append(kv.PoolStateEviction, encID, encIDs); err != nil {
|
if err := tx.Append(kv.PoolStateEviction, encID, encIDs); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err := tx.Cursor(kv.PoolStateEviction)
|
c, err := tx.Cursor(kv.PoolStateEviction)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user