Update state_processor.go

This commit is contained in:
maradini77 2025-09-29 16:27:58 +02:00 committed by GitHub
parent 891bbad9ce
commit e5acf45a04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -37,16 +37,27 @@ import (
type StateProcessor struct { type StateProcessor struct {
config *params.ChainConfig // Chain configuration options config *params.ChainConfig // Chain configuration options
chain *HeaderChain // Canonical header chain chain *HeaderChain // Canonical header chain
signerFactory types.SignerFactory
} }
// NewStateProcessor initialises a new StateProcessor. // NewStateProcessor initialises a new StateProcessor.
func NewStateProcessor(config *params.ChainConfig, chain *HeaderChain) *StateProcessor { func NewStateProcessor(config *params.ChainConfig, chain *HeaderChain) *StateProcessor {
return &StateProcessor{ return &StateProcessor{
config: config, config: config,
chain: chain, chain: chain,
signerFactory: types.NewStandardSignerFactory(),
} }
} }
// NewStateProcessorWithSignerFactory initialises a new StateProcessor with a specified signer factory.
func NewStateProcessorWithSignerFactory(config *params.ChainConfig, chain *HeaderChain, signerFactory types.SignerFactory) *StateProcessor {
return &StateProcessor{
config: config,
chain: chain,
signerFactory: signerFactory,
}
}
// Process processes the state changes according to the Ethereum rules by running // Process processes the state changes according to the Ethereum rules by running
// the transaction messages using the statedb and applying any rewards to both // the transaction messages using the statedb and applying any rewards to both
// the processor (coinbase) and any included uncles. // the processor (coinbase) and any included uncles.
@ -70,8 +81,8 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
misc.ApplyDAOHardFork(statedb) misc.ApplyDAOHardFork(statedb)
} }
var ( var (
context vm.BlockContext context vm.BlockContext
signer = types.MakeSigner(p.config, header.Number, header.Time) signer = p.signerFactory.MakeSigner(p.config, header.Number, header.Time)
) )
// Apply pre-execution system calls. // Apply pre-execution system calls.