add state check assert routine

This commit is contained in:
alex.sharov 2021-08-27 11:00:56 +07:00
parent ff451545d9
commit b8381cfd3a
3 changed files with 8 additions and 9 deletions

View File

@ -66,7 +66,6 @@ var DefaultTimings = Timings{
// SentryClient here is an interface, it is suitable for mocking in tests (mock will need
// to implement all the functions of the SentryClient interface).
func NewFetch(ctx context.Context, sentryClients []sentry.SentryClient, pool Pool, senders *SendersCache, stateChangesClient remote.KVClient, coreDB kv.RoDB, db kv.RwDB) *Fetch {
pooledTxsParseCtx := NewTxParseContext()
return &Fetch{
ctx: ctx,
sentryClients: sentryClients,
@ -76,7 +75,7 @@ func NewFetch(ctx context.Context, sentryClients []sentry.SentryClient, pool Poo
db: db,
stateChangesClient: stateChangesClient,
stateChangesParseCtx: NewTxParseContext(),
pooledTxsParseCtx: pooledTxsParseCtx,
pooledTxsParseCtx: NewTxParseContext(),
}
}

View File

@ -17,6 +17,7 @@
package txpool
import (
"bytes"
"errors"
"fmt"
@ -192,6 +193,12 @@ func ParsePooledTransactions65(payload []byte, pos int, ctx *TxParseContext, txS
}
return 0, err
}
if ASSERT {
if bytes.Equal(txSlots.txs[i].idHash[:], EmptyAddr[:]) {
fmt.Printf("etmpy: %#v\n", txSlots.txs[i])
panic("?????")
}
}
}
return pos, nil
}

View File

@ -913,13 +913,6 @@ func (p *TxPool) OnNewTxs(ctx context.Context, coreDB kv.RoDB, newTxs TxSlots, s
return err
}
if ASSERT {
for i := range p.senders.senderIDs {
if bytes.Equal([]byte(i), EmptyAddr[:]) {
panic(8)
}
}
}
protocolBaseFee, pendingBaseFee := p.protocolBaseFee.Load(), p.pendingBaseFee.Load()
if protocolBaseFee == 0 || pendingBaseFee == 0 {
return fmt.Errorf("non-zero base fee: %d,%d", protocolBaseFee, pendingBaseFee)