placeholder withdrawal handling
Some checks failed
Test the stack. / Run unit tests (pull_request) Has been cancelled
Test the stack. / Run integration tests (pull_request) Has been cancelled

This commit is contained in:
Roy Crihfield 2024-05-09 20:41:27 +08:00
parent fc58ee47f4
commit c71f2f4071

View File

@ -349,8 +349,21 @@ func (b *Backend) BlockByHash(ctx context.Context, hash common.Hash) (*types.Blo
return nil, err
}
// Placeholder for withdrawal processing (TODO)
var withdrawals types.Withdrawals
if b.Config.ChainConfig.IsShanghai(header.Number, header.Time) {
// All blocks after Shanghai must include a withdrawals root.
if withdrawals == nil {
withdrawals = make(types.Withdrawals, 0)
}
} else {
if len(withdrawals) > 0 {
return nil, errors.New("withdrawals set before Shanghai activation")
}
}
// Compose everything together into a complete block
return types.NewBlock(header, transactions, uncles, receipts, trie.NewEmpty(nil)), err
return types.NewBlockWithWithdrawals(header, transactions, uncles, receipts, withdrawals, trie.NewEmpty(nil)), err
}
// GetHeaderByBlockHash retrieves header for a provided block hash