Skip to content

Commit a1d9ef4

Browse files
committed
core, eth, rpc: split out block validator and state processor
This removes the burden on a single object to take care of all validation and state processing. Now instead the validation is done by the `core.BlockValidator` (`types.Validator`) that takes care of both header and uncle validation through the `ValidateBlock` method and state validation through the `ValidateState` method. The state processing is done by a new object `core.StateProcessor` (`types.Processor`) and accepts a new state as input and uses that to process the given block's transactions (and uncles for rewords) to calculate the state root for the next block (P_n + 1).
1 parent 9422eec commit a1d9ef4

19 files changed

+701
-642
lines changed

cmd/utils/flags.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,6 @@ func MakeChain(ctx *cli.Context) (chain *core.BlockChain, chainDb ethdb.Database
557557
Fatalf("Could not start chainmanager: %v", err)
558558
}
559559

560-
proc := core.NewBlockProcessor(chainDb, pow, chain, eventMux)
561-
chain.SetProcessor(proc)
562560
return chain, chainDb
563561
}
564562

core/bench_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ func benchInsertChain(b *testing.B, disk bool, gen func(int, *BlockGen)) {
169169
// State and blocks are stored in the same DB.
170170
evmux := new(event.TypeMux)
171171
chainman, _ := NewBlockChain(db, FakePow{}, evmux)
172-
chainman.SetProcessor(NewBlockProcessor(db, FakePow{}, chainman, evmux))
173172
defer chainman.Stop()
174173
b.ReportAllocs()
175174
b.ResetTimer()

0 commit comments

Comments
 (0)