mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
f3d6dbcc1e
* config params into pkg * gaz Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
26 lines
722 B
Go
26 lines
722 B
Go
package beacon
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"reflect"
|
|
|
|
"github.com/prysmaticlabs/prysm/config/params"
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
|
"google.golang.org/protobuf/types/known/emptypb"
|
|
)
|
|
|
|
// GetBeaconConfig retrieves the current configuration parameters of the beacon chain.
|
|
func (bs *Server) GetBeaconConfig(_ context.Context, _ *emptypb.Empty) (*ethpb.BeaconConfig, error) {
|
|
conf := params.BeaconConfig()
|
|
val := reflect.ValueOf(conf).Elem()
|
|
numFields := val.Type().NumField()
|
|
res := make(map[string]string, numFields)
|
|
for i := 0; i < numFields; i++ {
|
|
res[val.Type().Field(i).Name] = fmt.Sprintf("%v", val.Field(i).Interface())
|
|
}
|
|
return ðpb.BeaconConfig{
|
|
Config: res,
|
|
}, nil
|
|
}
|