@@ -131,7 +131,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, tra
131
131
}
132
132
statedb .SetTxContext (tx .Hash (), i )
133
133
134
- receipt , gas , err , tokenFeeUsed := ApplyTransactionWithEVM (msg , p .config , gp , statedb , blockNumber , blockHash , tx , usedGas , vmenv , balanceFee , coinbaseOwner )
134
+ receipt , gas , tokenFeeUsed , err := ApplyTransactionWithEVM (msg , p .config , gp , statedb , blockNumber , blockHash , tx , usedGas , vmenv , balanceFee , coinbaseOwner )
135
135
if err != nil {
136
136
return nil , nil , 0 , fmt .Errorf ("could not apply tx %d [%v]: %w" , i , tx .Hash ().Hex (), err )
137
137
}
@@ -222,7 +222,7 @@ func (p *StateProcessor) ProcessBlockNoValidator(cBlock *CalculatedBlock, stated
222
222
return nil , nil , 0 , err
223
223
}
224
224
statedb .SetTxContext (tx .Hash (), i )
225
- receipt , gas , err , tokenFeeUsed := ApplyTransactionWithEVM (msg , p .config , gp , statedb , blockNumber , blockHash , tx , usedGas , vmenv , balanceFee , coinbaseOwner )
225
+ receipt , gas , tokenFeeUsed , err := ApplyTransactionWithEVM (msg , p .config , gp , statedb , blockNumber , blockHash , tx , usedGas , vmenv , balanceFee , coinbaseOwner )
226
226
if err != nil {
227
227
return nil , nil , 0 , err
228
228
}
@@ -247,7 +247,7 @@ func (p *StateProcessor) ProcessBlockNoValidator(cBlock *CalculatedBlock, stated
247
247
// ApplyTransactionWithEVM attempts to apply a transaction to the given state database
248
248
// and uses the input parameters for its environment similar to ApplyTransaction. However,
249
249
// this method takes an already created EVM instance as input.
250
- func ApplyTransactionWithEVM (msg * Message , config * params.ChainConfig , gp * GasPool , statedb * state.StateDB , blockNumber * big.Int , blockHash common.Hash , tx * types.Transaction , usedGas * uint64 , evm * vm.EVM , balanceFee * big.Int , coinbaseOwner common.Address ) (receipt * types.Receipt , gasUsed uint64 , err error , tokenFeeUsed bool ) {
250
+ func ApplyTransactionWithEVM (msg * Message , config * params.ChainConfig , gp * GasPool , statedb * state.StateDB , blockNumber * big.Int , blockHash common.Hash , tx * types.Transaction , usedGas * uint64 , evm * vm.EVM , balanceFee * big.Int , coinbaseOwner common.Address ) (receipt * types.Receipt , gasUsed uint64 , tokenFeeUsed bool , err error ) {
251
251
to := tx .To ()
252
252
if to != nil {
253
253
if * to == common .BlockSignersBinary && config .IsTIPSigning (blockNumber ) {
@@ -428,7 +428,7 @@ func ApplyTransactionWithEVM(msg *Message, config *params.ChainConfig, gp *GasPo
428
428
// Apply the transaction to the current state (included in the env)
429
429
result , err := ApplyMessage (evm , msg , gp , coinbaseOwner )
430
430
if err != nil {
431
- return nil , 0 , err , false
431
+ return nil , 0 , false , err
432
432
}
433
433
434
434
// Update the state with pending changes.
@@ -465,7 +465,7 @@ func ApplyTransactionWithEVM(msg *Message, config *params.ChainConfig, gp *GasPo
465
465
if balanceFee != nil && result .Failed () {
466
466
state .PayFeeWithTRC21TxFail (statedb , msg .From , * to )
467
467
}
468
- return receipt , result .UsedGas , err , balanceFee != nil
468
+ return receipt , result .UsedGas , balanceFee != nil , nil
469
469
}
470
470
471
471
func getCoinbaseOwner (bc * BlockChain , statedb * state.StateDB , header * types.Header , author * common.Address ) common.Address {
@@ -483,7 +483,7 @@ func getCoinbaseOwner(bc *BlockChain, statedb *state.StateDB, header *types.Head
483
483
// and uses the input parameters for its environment. It returns the receipt
484
484
// for the transaction, gas used and an error if the transaction failed,
485
485
// indicating the block was invalid.
486
- func ApplyTransaction (config * params.ChainConfig , tokensFee map [common.Address ]* big.Int , bc * BlockChain , author * common.Address , gp * GasPool , statedb * state.StateDB , XDCxState * tradingstate.TradingStateDB , header * types.Header , tx * types.Transaction , usedGas * uint64 , cfg vm.Config ) (* types.Receipt , uint64 , error , bool ) {
486
+ func ApplyTransaction (config * params.ChainConfig , tokensFee map [common.Address ]* big.Int , bc * BlockChain , author * common.Address , gp * GasPool , statedb * state.StateDB , XDCxState * tradingstate.TradingStateDB , header * types.Header , tx * types.Transaction , usedGas * uint64 , cfg vm.Config ) (* types.Receipt , uint64 , bool , error ) {
487
487
var balanceFee * big.Int
488
488
if tx .To () != nil {
489
489
if value , ok := tokensFee [* tx .To ()]; ok {
@@ -497,13 +497,13 @@ func ApplyTransaction(config *params.ChainConfig, tokensFee map[common.Address]*
497
497
signer := types .MakeSigner (config , header .Number )
498
498
msg , err := TransactionToMessage (tx , signer , balanceFee , header .Number , header .BaseFee )
499
499
if err != nil {
500
- return nil , 0 , err , false
500
+ return nil , 0 , false , err
501
501
}
502
502
coinbaseOwner := getCoinbaseOwner (bc , statedb , header , author )
503
503
return ApplyTransactionWithEVM (msg , config , gp , statedb , header .Number , header .Hash (), tx , usedGas , vmenv , balanceFee , coinbaseOwner )
504
504
}
505
505
506
- func ApplySignTransaction (config * params.ChainConfig , statedb * state.StateDB , blockNumber * big.Int , blockHash common.Hash , tx * types.Transaction , usedGas * uint64 ) (* types.Receipt , uint64 , error , bool ) {
506
+ func ApplySignTransaction (config * params.ChainConfig , statedb * state.StateDB , blockNumber * big.Int , blockHash common.Hash , tx * types.Transaction , usedGas * uint64 ) (* types.Receipt , uint64 , bool , error ) {
507
507
// Update the state with pending changes
508
508
var root []byte
509
509
if config .IsByzantium (blockNumber ) {
@@ -513,13 +513,13 @@ func ApplySignTransaction(config *params.ChainConfig, statedb *state.StateDB, bl
513
513
}
514
514
from , err := types .Sender (types .MakeSigner (config , blockNumber ), tx )
515
515
if err != nil {
516
- return nil , 0 , err , false
516
+ return nil , 0 , false , err
517
517
}
518
518
nonce := statedb .GetNonce (from )
519
519
if nonce < tx .Nonce () {
520
- return nil , 0 , ErrNonceTooHigh , false
520
+ return nil , 0 , false , ErrNonceTooHigh
521
521
} else if nonce > tx .Nonce () {
522
- return nil , 0 , ErrNonceTooLow , false
522
+ return nil , 0 , false , ErrNonceTooLow
523
523
}
524
524
statedb .SetNonce (from , nonce + 1 )
525
525
// Create a new receipt for the transaction, storing the intermediate root and gas used by the tx
@@ -538,10 +538,10 @@ func ApplySignTransaction(config *params.ChainConfig, statedb *state.StateDB, bl
538
538
receipt .BlockHash = blockHash
539
539
receipt .BlockNumber = blockNumber
540
540
receipt .TransactionIndex = uint (statedb .TxIndex ())
541
- return receipt , 0 , nil , false
541
+ return receipt , 0 , false , nil
542
542
}
543
543
544
- func ApplyEmptyTransaction (config * params.ChainConfig , statedb * state.StateDB , blockNumber * big.Int , blockHash common.Hash , tx * types.Transaction , usedGas * uint64 ) (* types.Receipt , uint64 , error , bool ) {
544
+ func ApplyEmptyTransaction (config * params.ChainConfig , statedb * state.StateDB , blockNumber * big.Int , blockHash common.Hash , tx * types.Transaction , usedGas * uint64 ) (* types.Receipt , uint64 , bool , error ) {
545
545
// Update the state with pending changes
546
546
var root []byte
547
547
if config .IsByzantium (blockNumber ) {
@@ -565,7 +565,7 @@ func ApplyEmptyTransaction(config *params.ChainConfig, statedb *state.StateDB, b
565
565
receipt .BlockHash = blockHash
566
566
receipt .BlockNumber = blockNumber
567
567
receipt .TransactionIndex = uint (statedb .TxIndex ())
568
- return receipt , 0 , nil , false
568
+ return receipt , 0 , false , nil
569
569
}
570
570
571
571
func InitSignerInTransactions (config * params.ChainConfig , header * types.Header , txs types.Transactions ) {
0 commit comments