2021-11-17 09:04:49 +00:00
|
|
|
package v3
|
|
|
|
|
|
|
|
import (
|
2021-11-25 20:41:05 +00:00
|
|
|
"context"
|
2021-11-17 09:04:49 +00:00
|
|
|
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil"
|
|
|
|
"github.com/prysmaticlabs/prysm/config/features"
|
|
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
|
|
|
)
|
|
|
|
|
|
|
|
// computeFieldRoots returns the hash tree root computations of every field in
|
|
|
|
// the beacon state as a list of 32 byte roots.
|
2021-11-29 16:30:17 +00:00
|
|
|
//nolint:deadcode
|
2021-11-25 20:41:05 +00:00
|
|
|
func computeFieldRoots(ctx context.Context, state *ethpb.BeaconStateMerge) ([][]byte, error) {
|
2021-11-17 09:04:49 +00:00
|
|
|
if features.Get().EnableSSZCache {
|
2021-11-29 16:30:17 +00:00
|
|
|
return stateutil.CachedHasher.ComputeFieldRootsWithHasherMerge(ctx, state)
|
2021-11-17 09:04:49 +00:00
|
|
|
}
|
2021-11-29 16:30:17 +00:00
|
|
|
return stateutil.NocachedHasher.ComputeFieldRootsWithHasherMerge(ctx, state)
|
2021-11-17 09:04:49 +00:00
|
|
|
}
|