@@ -20,10 +20,12 @@ package catalyst
20
20
import (
21
21
"errors"
22
22
"fmt"
23
+ "reflect"
23
24
"strconv"
24
25
"sync"
25
26
"sync/atomic"
26
27
"time"
28
+ "unicode"
27
29
28
30
"github.com/ethereum/go-ethereum/beacon/engine"
29
31
"github.com/ethereum/go-ethereum/common"
@@ -80,41 +82,6 @@ const (
80
82
beaconUpdateWarnFrequency = 5 * time .Minute
81
83
)
82
84
83
- // All methods provided over the engine endpoint.
84
- var caps = []string {
85
- "engine_forkchoiceUpdatedV1" ,
86
- "engine_forkchoiceUpdatedV2" ,
87
- "engine_forkchoiceUpdatedV3" ,
88
- "engine_forkchoiceUpdatedWithWitnessV1" ,
89
- "engine_forkchoiceUpdatedWithWitnessV2" ,
90
- "engine_forkchoiceUpdatedWithWitnessV3" ,
91
- "engine_exchangeTransitionConfigurationV1" ,
92
- "engine_getPayloadV1" ,
93
- "engine_getPayloadV2" ,
94
- "engine_getPayloadV3" ,
95
- "engine_getPayloadV4" ,
96
- "engine_getPayloadV5" ,
97
- "engine_getBlobsV1" ,
98
- "engine_getBlobsV2" ,
99
- "engine_newPayloadV1" ,
100
- "engine_newPayloadV2" ,
101
- "engine_newPayloadV3" ,
102
- "engine_newPayloadV4" ,
103
- "engine_newPayloadWithWitnessV1" ,
104
- "engine_newPayloadWithWitnessV2" ,
105
- "engine_newPayloadWithWitnessV3" ,
106
- "engine_newPayloadWithWitnessV4" ,
107
- "engine_executeStatelessPayloadV1" ,
108
- "engine_executeStatelessPayloadV2" ,
109
- "engine_executeStatelessPayloadV3" ,
110
- "engine_executeStatelessPayloadV4" ,
111
- "engine_getPayloadBodiesByHashV1" ,
112
- "engine_getPayloadBodiesByHashV2" ,
113
- "engine_getPayloadBodiesByRangeV1" ,
114
- "engine_getPayloadBodiesByRangeV2" ,
115
- "engine_getClientVersionV1" ,
116
- }
117
-
118
85
var (
119
86
// Number of blobs requested via getBlobsV2
120
87
getBlobsRequestedCounter = metrics .NewRegisteredCounter ("engine/getblobs/requested" , nil )
@@ -916,6 +883,15 @@ func (api *ConsensusAPI) checkFork(timestamp uint64, forks ...forks.Fork) bool {
916
883
917
884
// ExchangeCapabilities returns the current methods provided by this node.
918
885
func (api * ConsensusAPI ) ExchangeCapabilities ([]string ) []string {
886
+ valueT := reflect .TypeOf (api )
887
+ caps := make ([]string , 0 , valueT .NumMethod ())
888
+ for i := 0 ; i < valueT .NumMethod (); i ++ {
889
+ name := []rune (valueT .Method (i ).Name )
890
+ if string (name ) == "ExchangeCapabilities" {
891
+ continue
892
+ }
893
+ caps = append (caps , "engine_" + string (unicode .ToLower (name [0 ]))+ string (name [1 :]))
894
+ }
919
895
return caps
920
896
}
921
897
0 commit comments