mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-05 18:42:19 +00:00
add state check assert routine
This commit is contained in:
parent
001b298297
commit
2135e3200c
@ -627,6 +627,31 @@ func (sc *SendersCache) flush(tx kv.RwTx, byNonce *ByNonce, sendersWithoutTransa
|
||||
}
|
||||
}
|
||||
fmt.Printf("justDeleted:%d, justInserted:%d\n", justDeleted, justInserted)
|
||||
if ASSERT {
|
||||
{
|
||||
duplicates := map[string]uint64{}
|
||||
_ = tx.ForPrefix(kv.PooledSenderIDToAdress, nil, func(k, v []byte) error {
|
||||
id, ok := duplicates[string(v)]
|
||||
if ok {
|
||||
fmt.Printf("duplicate: %d,%d,%x\n", id, binary.BigEndian.Uint64(k), string(v))
|
||||
panic(1)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
{
|
||||
duplicates := map[uint64]string{}
|
||||
_ = tx.ForPrefix(kv.PooledSenderIDToAdress, nil, func(k, v []byte) error {
|
||||
id := binary.BigEndian.Uint64(v)
|
||||
addr, ok := duplicates[id]
|
||||
if ok {
|
||||
fmt.Printf("duplicate: %x,%x,%d\n", addr, k, binary.BigEndian.Uint64(v))
|
||||
panic(1)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
}
|
||||
if ASSERT {
|
||||
_ = tx.ForEach(kv.PooledTransaction, nil, func(k, v []byte) error {
|
||||
vv, err := tx.GetOne(kv.PooledSenderIDToAdress, v[:8])
|
||||
|
Loading…
Reference in New Issue
Block a user