mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-26 13:18:57 +00:00
1478882b41
* add patch and endpoint * formatting * Merge branch 'master' into chain-config-endpoint * Merge branch 'master' into chain-config-endpoint * include beacon config * config params * Merge branch 'chain-config-endpoint' of github.com:prysmaticlabs/prysm into chain-config-endpoint * include tests * resolve confs * use patch * Merge branch 'master' into chain-config-endpoint * passing tests * Merge branch 'chain-config-endpoint' of github.com:prysmaticlabs/prysm into chain-config-endpoint * Merge branch 'master' into chain-config-endpoint * Merge branch 'master' into chain-config-endpoint * Merge refs/heads/master into chain-config-endpoint
26 lines
713 B
Go
26 lines
713 B
Go
package beacon
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"reflect"
|
|
|
|
ptypes "github.com/gogo/protobuf/types"
|
|
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
|
"github.com/prysmaticlabs/prysm/shared/params"
|
|
)
|
|
|
|
// GetBeaconConfig retrieves the current configuration parameters of the beacon chain.
|
|
func (bs *Server) GetBeaconConfig(ctx context.Context, _ *ptypes.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
|
|
}
|