|
@@ -68,7 +68,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
|
|
|
// Iterate over and process the individual transactions
|
|
// Iterate over and process the individual transactions
|
|
|
for i, tx := range block.Transactions() {
|
|
for i, tx := range block.Transactions() {
|
|
|
statedb.Prepare(tx.Hash(), block.Hash(), i)
|
|
statedb.Prepare(tx.Hash(), block.Hash(), i)
|
|
|
- receipt, _, err := ApplyTransaction(p.config, p.bc, nil, gp, statedb, header, tx, usedGas, cfg)
|
|
|
|
|
|
|
+ receipt, err := ApplyTransaction(p.config, p.bc, nil, gp, statedb, header, tx, usedGas, cfg)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return nil, nil, 0, err
|
|
return nil, nil, 0, err
|
|
|
}
|
|
}
|
|
@@ -85,10 +85,10 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
|
|
|
// and uses the input parameters for its environment. It returns the receipt
|
|
// and uses the input parameters for its environment. It returns the receipt
|
|
|
// for the transaction, gas used and an error if the transaction failed,
|
|
// for the transaction, gas used and an error if the transaction failed,
|
|
|
// indicating the block was invalid.
|
|
// indicating the block was invalid.
|
|
|
-func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *common.Address, gp *GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, usedGas *uint64, cfg vm.Config) (*types.Receipt, uint64, error) {
|
|
|
|
|
|
|
+func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *common.Address, gp *GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, usedGas *uint64, cfg vm.Config) (*types.Receipt, error) {
|
|
|
msg, err := tx.AsMessage(types.MakeSigner(config, header.Number))
|
|
msg, err := tx.AsMessage(types.MakeSigner(config, header.Number))
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
- return nil, 0, err
|
|
|
|
|
|
|
+ return nil, err
|
|
|
}
|
|
}
|
|
|
// Create a new context to be used in the EVM environment
|
|
// Create a new context to be used in the EVM environment
|
|
|
context := NewEVMContext(msg, header, bc, author)
|
|
context := NewEVMContext(msg, header, bc, author)
|
|
@@ -98,7 +98,7 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
|
|
|
// Apply the transaction to the current state (included in the env)
|
|
// Apply the transaction to the current state (included in the env)
|
|
|
_, gas, failed, err := ApplyMessage(vmenv, msg, gp)
|
|
_, gas, failed, err := ApplyMessage(vmenv, msg, gp)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
- return nil, 0, err
|
|
|
|
|
|
|
+ return nil, err
|
|
|
}
|
|
}
|
|
|
// Update the state with pending changes
|
|
// Update the state with pending changes
|
|
|
var root []byte
|
|
var root []byte
|
|
@@ -125,5 +125,5 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
|
|
|
receipt.BlockNumber = header.Number
|
|
receipt.BlockNumber = header.Number
|
|
|
receipt.TransactionIndex = uint(statedb.TxIndex())
|
|
receipt.TransactionIndex = uint(statedb.TxIndex())
|
|
|
|
|
|
|
|
- return receipt, gas, err
|
|
|
|
|
|
|
+ return receipt, err
|
|
|
}
|
|
}
|