|
@@ -19,9 +19,11 @@ package eth
|
|
|
import (
|
|
import (
|
|
|
"errors"
|
|
"errors"
|
|
|
"fmt"
|
|
"fmt"
|
|
|
|
|
+ "math/big"
|
|
|
"time"
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
|
+ "github.com/ethereum/go-ethereum/consensus"
|
|
|
"github.com/ethereum/go-ethereum/core"
|
|
"github.com/ethereum/go-ethereum/core"
|
|
|
"github.com/ethereum/go-ethereum/core/state"
|
|
"github.com/ethereum/go-ethereum/core/state"
|
|
|
"github.com/ethereum/go-ethereum/core/types"
|
|
"github.com/ethereum/go-ethereum/core/types"
|
|
@@ -170,6 +172,14 @@ func (eth *Ethereum) stateAtTransaction(block *types.Block, txIndex int, reexec
|
|
|
}
|
|
}
|
|
|
// Not yet the searched for transaction, execute on top of the current state
|
|
// Not yet the searched for transaction, execute on top of the current state
|
|
|
vmenv := vm.NewEVM(context, txContext, statedb, eth.blockchain.Config(), vm.Config{})
|
|
vmenv := vm.NewEVM(context, txContext, statedb, eth.blockchain.Config(), vm.Config{})
|
|
|
|
|
+ if posa, ok := eth.Engine().(consensus.PoSA); ok && msg.From() == context.Coinbase &&
|
|
|
|
|
+ posa.IsSystemContract(msg.To()) && msg.GasPrice().Cmp(big.NewInt(0)) == 0 {
|
|
|
|
|
+ balance := statedb.GetBalance(consensus.SystemAddress)
|
|
|
|
|
+ if balance.Cmp(common.Big0) > 0 {
|
|
|
|
|
+ statedb.SetBalance(consensus.SystemAddress, big.NewInt(0))
|
|
|
|
|
+ statedb.AddBalance(context.Coinbase, balance)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
statedb.Prepare(tx.Hash(), block.Hash(), idx)
|
|
statedb.Prepare(tx.Hash(), block.Hash(), idx)
|
|
|
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(tx.Gas())); err != nil {
|
|
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(tx.Gas())); err != nil {
|
|
|
return nil, vm.BlockContext{}, nil, fmt.Errorf("transaction %#x failed: %v", tx.Hash(), err)
|
|
return nil, vm.BlockContext{}, nil, fmt.Errorf("transaction %#x failed: %v", tx.Hash(), err)
|