mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
e3: to produce stateChanges stream (#7692)
This commit is contained in:
parent
afa4f53ae2
commit
2c39570077
@ -149,6 +149,7 @@ func ExecV3(ctx context.Context,
|
||||
parallel bool, logPrefix string,
|
||||
maxBlockNum uint64,
|
||||
logger log.Logger,
|
||||
initialCycle bool,
|
||||
) error {
|
||||
batchSize := cfg.batchSize
|
||||
chainDb := cfg.db
|
||||
@ -503,6 +504,8 @@ func ExecV3(ctx context.Context,
|
||||
slowDownLimit := time.NewTicker(time.Second)
|
||||
defer slowDownLimit.Stop()
|
||||
|
||||
stateStream := !initialCycle && cfg.stateStream && maxBlockNum-block < stateStreamLimit
|
||||
|
||||
var b *types.Block
|
||||
var blockNum uint64
|
||||
var err error
|
||||
@ -560,6 +563,14 @@ Loop:
|
||||
}
|
||||
}
|
||||
}()
|
||||
} else {
|
||||
if !initialCycle && stateStream {
|
||||
txs, err := blockReader.RawTransactions(context.Background(), applyTx, b.NumberU64(), b.NumberU64())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cfg.accumulator.StartChange(b.NumberU64(), b.Hash(), txs, false)
|
||||
}
|
||||
}
|
||||
|
||||
rules := chainConfig.Rules(blockNum, b.Time())
|
||||
|
@ -277,7 +277,7 @@ func ExecBlockV3(s *StageState, u Unwinder, tx kv.RwTx, toBlock uint64, ctx cont
|
||||
}
|
||||
parallel := initialCycle && tx == nil
|
||||
if err := ExecV3(ctx, s, u, workersCount, cfg, tx, parallel, logPrefix,
|
||||
to, logger); err != nil {
|
||||
to, logger, initialCycle); err != nil {
|
||||
return fmt.Errorf("ExecV3: %w", err)
|
||||
}
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user