mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
fix: added restrictions in engine capabilities
This commit is contained in:
parent
e58c785424
commit
7c2424e3c7
1 changed files with 13 additions and 1 deletions
|
|
@ -981,11 +981,23 @@ func (api *ConsensusAPI) checkFork(timestamp uint64, forks ...forks.Fork) bool {
|
|||
func (api *ConsensusAPI) ExchangeCapabilities([]string) []string {
|
||||
valueT := reflect.TypeOf(api)
|
||||
caps := make([]string, 0, valueT.NumMethod())
|
||||
restrictions := map[string]func() bool{
|
||||
"GetBlobsV2": func() bool {
|
||||
cfg := api.config()
|
||||
return cfg.OsakaTime != nil && uint64(time.Now().Unix()) >= *cfg.OsakaTime
|
||||
},
|
||||
}
|
||||
for i := 0; i < valueT.NumMethod(); i++ {
|
||||
name := []rune(valueT.Method(i).Name)
|
||||
methodName := valueT.Method(i).Name
|
||||
name := []rune(methodName)
|
||||
if string(name) == "ExchangeCapabilities" {
|
||||
continue
|
||||
}
|
||||
if isAllowed, exists := restrictions[methodName]; exists {
|
||||
if !isAllowed() {
|
||||
continue
|
||||
}
|
||||
}
|
||||
caps = append(caps, "engine_"+string(unicode.ToLower(name[0]))+string(name[1:]))
|
||||
}
|
||||
return caps
|
||||
|
|
|
|||
Loading…
Reference in a new issue