mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
fix : testcase : config, addTxWithChain, burnAmount
This commit is contained in:
parent
64486d0a82
commit
392bebdb05
3 changed files with 2 additions and 11 deletions
|
|
@ -79,7 +79,7 @@ type SimulatedBackend struct {
|
||||||
// A simulated backend always uses chainID 1337.
|
// A simulated backend always uses chainID 1337.
|
||||||
func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
|
func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
|
||||||
genesis := core.Genesis{
|
genesis := core.Genesis{
|
||||||
Config: params.AllEthashProtocolChanges,
|
Config: params.BorUnittestChainConfig,
|
||||||
GasLimit: gasLimit,
|
GasLimit: gasLimit,
|
||||||
Alloc: alloc,
|
Alloc: alloc,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -135,15 +135,6 @@ func (b *BlockGen) AddTx(tx *types.Transaction) {
|
||||||
// the block in chain will be returned.
|
// the block in chain will be returned.
|
||||||
func (b *BlockGen) AddTxWithChain(bc *BlockChain, tx *types.Transaction) {
|
func (b *BlockGen) AddTxWithChain(bc *BlockChain, tx *types.Transaction) {
|
||||||
b.addTx(bc, vm.Config{}, tx)
|
b.addTx(bc, vm.Config{}, tx)
|
||||||
b.statedb.SetTxContext(tx.Hash(), len(b.txs))
|
|
||||||
|
|
||||||
receipt, err := ApplyTransaction(b.config, bc, &b.header.Coinbase, b.gasPool, b.statedb, b.header, tx, &b.header.GasUsed, vm.Config{}, nil)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
b.txs = append(b.txs, tx)
|
|
||||||
b.receipts = append(b.receipts, receipt)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddTxWithVMConfig adds a transaction to the generated block. If no coinbase has
|
// AddTxWithVMConfig adds a transaction to the generated block. If no coinbase has
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,7 @@ func (st *StateTransition) TransitionDb(interruptCtx context.Context) (*Executio
|
||||||
|
|
||||||
if rules.IsLondon {
|
if rules.IsLondon {
|
||||||
burntContractAddress := common.HexToAddress(st.evm.ChainConfig().Bor.CalculateBurntContract(st.evm.Context.BlockNumber.Uint64()))
|
burntContractAddress := common.HexToAddress(st.evm.ChainConfig().Bor.CalculateBurntContract(st.evm.Context.BlockNumber.Uint64()))
|
||||||
burnAmount := new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.evm.Context.BaseFee)
|
burnAmount = new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.evm.Context.BaseFee)
|
||||||
|
|
||||||
if !st.noFeeBurnAndTip {
|
if !st.noFeeBurnAndTip {
|
||||||
st.state.AddBalance(burntContractAddress, burnAmount)
|
st.state.AddBalance(burntContractAddress, burnAmount)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue