mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
core/types: rename to CalcRequestsHash
This commit is contained in:
parent
a2abb4b3a3
commit
b3cff4ee5f
5 changed files with 6 additions and 6 deletions
|
|
@ -260,7 +260,7 @@ func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.H
|
||||||
// Compute requestsHash if any requests are non-nil.
|
// Compute requestsHash if any requests are non-nil.
|
||||||
var requestsHash *common.Hash
|
var requestsHash *common.Hash
|
||||||
if data.Requests != nil {
|
if data.Requests != nil {
|
||||||
h := types.CalcRequestHash(data.Requests)
|
h := types.CalcRequestsHash(data.Requests)
|
||||||
requestsHash = &h
|
requestsHash = &h
|
||||||
}
|
}
|
||||||
header := &types.Header{
|
header := &types.Header{
|
||||||
|
|
|
||||||
|
|
@ -390,7 +390,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
|
||||||
return nil, nil, nil, NewError(ErrorEVM, fmt.Errorf("could not parse requests logs: %v", err))
|
return nil, nil, nil, NewError(ErrorEVM, fmt.Errorf("could not parse requests logs: %v", err))
|
||||||
}
|
}
|
||||||
// Calculate the requests root
|
// Calculate the requests root
|
||||||
h := types.CalcRequestHash(requests)
|
h := types.CalcRequestsHash(requests)
|
||||||
execRs.RequestsHash = &h
|
execRs.RequestsHash = &h
|
||||||
execRs.Requests = requests
|
execRs.Requests = requests
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateD
|
||||||
}
|
}
|
||||||
// Validate the parsed requests match the expected header value.
|
// Validate the parsed requests match the expected header value.
|
||||||
if header.RequestsHash != nil {
|
if header.RequestsHash != nil {
|
||||||
reqhash := types.CalcRequestHash(res.Requests)
|
reqhash := types.CalcRequestsHash(res.Requests)
|
||||||
if reqhash != *header.RequestsHash {
|
if reqhash != *header.RequestsHash {
|
||||||
return fmt.Errorf("invalid deposit root hash (remote: %x local: %x)", *header.RequestsHash, reqhash)
|
return fmt.Errorf("invalid deposit root hash (remote: %x local: %x)", *header.RequestsHash, reqhash)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@ func NewBlock(header *Header, body *Body, receipts []*Receipt, hasher TrieHasher
|
||||||
b.header.RequestsHash = &EmptyRequestsHash
|
b.header.RequestsHash = &EmptyRequestsHash
|
||||||
b.requests = [][]byte{}
|
b.requests = [][]byte{}
|
||||||
} else {
|
} else {
|
||||||
h := CalcRequestHash(requests)
|
h := CalcRequestsHash(requests)
|
||||||
b.header.RequestsHash = &h
|
b.header.RequestsHash = &h
|
||||||
b.requests = slices.Clone(requests)
|
b.requests = slices.Clone(requests)
|
||||||
}
|
}
|
||||||
|
|
@ -474,7 +474,7 @@ func CalcUncleHash(uncles []*Header) common.Hash {
|
||||||
return rlpHash(uncles)
|
return rlpHash(uncles)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CalcRequestHash(requests [][]byte) common.Hash {
|
func CalcRequestsHash(requests [][]byte) common.Hash {
|
||||||
if len(requests) == 0 {
|
if len(requests) == 0 {
|
||||||
return EmptyRequestsHash
|
return EmptyRequestsHash
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ func handleBlockBodies(backend Backend, msg Decoder, peer *Peer) error {
|
||||||
withdrawalHashes[i] = types.DeriveSha(types.Withdrawals(body.Withdrawals), hasher)
|
withdrawalHashes[i] = types.DeriveSha(types.Withdrawals(body.Withdrawals), hasher)
|
||||||
}
|
}
|
||||||
if body.Requests != nil {
|
if body.Requests != nil {
|
||||||
requestsHashes[i] = types.CalcRequestHash(body.Requests)
|
requestsHashes[i] = types.CalcRequestsHash(body.Requests)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [][]common.Hash{txsHashes, uncleHashes, withdrawalHashes, requestsHashes}
|
return [][]common.Hash{txsHashes, uncleHashes, withdrawalHashes, requestsHashes}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue