Skip to content

Commit

Permalink
Fixed getVersion
Browse files Browse the repository at this point in the history
Fixing getVersion.
  • Loading branch information
linuskendall committed Aug 20, 2023
1 parent 61d2157 commit 236691f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 2 additions & 7 deletions multiepoch-getVersion.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ func (ser *MultiEpoch) tryEnrichGetVersion(body []byte) ([]byte, error) {
faithfulVersion := ser.GetFaithfulVersionInfo()
decodedResult["faithful"] = faithfulVersion

solanaVersion := ser.GetSolanaVersionInfo()
for k,v := range solanaVersion {
decodedResult[k] = v
}

// re-encode the result:
// re-encode the result:
encodedResult, err := json.Marshal(decodedResult)
if err != nil {
return nil, fmt.Errorf("failed to re-encode result: %w", err)
Expand All @@ -49,7 +44,7 @@ func (ser *MultiEpoch) GetSolanaVersionInfo() map[string]any {
solanaVersion := make(map[string]any)
solanaVersion["feature-set"] = 1879391783
solanaVersion["solana-core"] = "1.16.7"
return solanaVersion
return solanaVersion
}

func (ser *MultiEpoch) GetFaithfulVersionInfo() map[string]any {
Expand Down
12 changes: 9 additions & 3 deletions multiepoch.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,19 @@ func newMultiEpochHandler(handler *MultiEpoch, lsConf *ListenerConfig) func(ctx
method := rpcRequest.Method

if method == "getVersion" {
versionInfo := make(map[string]any)
faithfulVersion := handler.GetFaithfulVersionInfo()
versionInfo["faithful"] = faithfulVersion

solanaVersion := handler.GetSolanaVersionInfo()
for k,v := range solanaVersion {
versionInfo[k] = v
}

err := rqCtx.ReplyNoMod(
c,
rpcRequest.ID,
map[string]any{
"faithful": faithfulVersion,
},
versionInfo,
)
if err != nil {
klog.Errorf("[%s] failed to reply to getVersion: %v", reqID, err)
Expand Down

0 comments on commit 236691f

Please sign in to comment.