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
c0ad0c6745
commit
7f1a72b997
@ -1078,13 +1078,18 @@ func (p *TxPool) flush(tx kv.RwTx, senders *SendersCache) error {
|
|||||||
binary.BigEndian.PutUint64(v, metaTx.Tx.senderID)
|
binary.BigEndian.PutUint64(v, metaTx.Tx.senderID)
|
||||||
binary.BigEndian.PutUint64(v[8:], 0) // block num - timestamp
|
binary.BigEndian.PutUint64(v[8:], 0) // block num - timestamp
|
||||||
copy(v[8+8:], metaTx.Tx.rlp)
|
copy(v[8+8:], metaTx.Tx.rlp)
|
||||||
currentV, err := tx.GetOne(kv.PooledTransaction, []byte(txHash))
|
if ASSERT {
|
||||||
if err != nil {
|
if _, ok := p.senders.senderInfo[metaTx.Tx.senderID]; !ok {
|
||||||
return err
|
info, err := p.senders.info(metaTx.Tx.senderID, tx)
|
||||||
}
|
if err != nil {
|
||||||
if currentV != nil && bytes.Equal(currentV, v) {
|
panic(err)
|
||||||
continue
|
}
|
||||||
|
if info == nil {
|
||||||
|
panic("lost")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := tx.Put(kv.PooledTransaction, []byte(txHash), v); err != nil {
|
if err := tx.Put(kv.PooledTransaction, []byte(txHash), v); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1715,7 +1720,7 @@ func BroadcastLoop(ctx context.Context, db kv.RwDB, coreDB kv.RoDB, p *TxPool, s
|
|||||||
|
|
||||||
logEvery := time.NewTicker(timings.logEvery)
|
logEvery := time.NewTicker(timings.logEvery)
|
||||||
defer logEvery.Stop()
|
defer logEvery.Stop()
|
||||||
commitEvery := time.NewTicker(3 * time.Second)
|
commitEvery := time.NewTicker(1 * time.Second)
|
||||||
defer commitEvery.Stop()
|
defer commitEvery.Stop()
|
||||||
|
|
||||||
syncToNewPeersEvery := time.NewTicker(timings.syncToNewPeersEvery)
|
syncToNewPeersEvery := time.NewTicker(timings.syncToNewPeersEvery)
|
||||||
|
Loading…
Reference in New Issue
Block a user