process withdrawals
This commit is contained in:
parent
3ad2cbaa8a
commit
43ccaba4b8
@ -334,7 +334,7 @@ func applyTransactions(block *types.Block, backend *ipldeth.Backend) (*ipldstate
|
|||||||
evm.Reset(core.NewEVMTxContext(msg), statedb)
|
evm.Reset(core.NewEVMTxContext(msg), statedb)
|
||||||
// Apply the transaction to the current state (included in the env).
|
// Apply the transaction to the current state (included in the env).
|
||||||
if _, err := core.ApplyMessage(evm, msg, &gp); err != nil {
|
if _, err := core.ApplyMessage(evm, msg, &gp); err != nil {
|
||||||
return nil, fmt.Errorf("transaction %#x failed: %w", tx.Hash(), err)
|
return nil, fmt.Errorf("error applying tx %#x: %w", tx.Hash(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.IsByzantium(block.Number()) {
|
if config.IsByzantium(block.Number()) {
|
||||||
@ -344,6 +344,14 @@ func applyTransactions(block *types.Block, backend *ipldeth.Backend) (*ipldstate
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Withdrawals processing.
|
||||||
|
for _, w := range block.Withdrawals() {
|
||||||
|
// Convert amount from gwei to wei.
|
||||||
|
amount := new(uint256.Int).SetUint64(w.Amount)
|
||||||
|
amount = amount.Mul(amount, uint256.NewInt(params.GWei))
|
||||||
|
statedb.AddBalance(w.Address, amount)
|
||||||
|
}
|
||||||
|
|
||||||
if config.Ethash != nil {
|
if config.Ethash != nil {
|
||||||
accumulateRewards(config, statedb, block.Header(), block.Uncles())
|
accumulateRewards(config, statedb, block.Header(), block.Uncles())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user