Skip to content

Commit

Permalink
Added getVersion placeholder
Browse files Browse the repository at this point in the history
Implementation of #38 on the multiepoch time.
  • Loading branch information
linuskendall committed Aug 19, 2023
1 parent 0f60ba9 commit 658be27
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
31 changes: 31 additions & 0 deletions multiepoch-getVersion.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package main

import (
"context"
"fmt"

"github.com/sourcegraph/jsonrpc2"
)

// @TODO make these values make sense
func (ser *MultiEpoch) handleGetVersion(ctx context.Context, conn *requestContext, req *jsonrpc2.Request) (*jsonrpc2.Error, error) {
// taken from solana mainnet version reponse
var versionResponse GetVersionResponse
versionResponse.FeatureSet = 1879391783
versionResponse.SolanaCore = "1.14.23"
var err = conn.Reply(
ctx,
req.ID,
versionResponse,
func(m map[string]any) map[string]any {
r := map[string]any{}
r["feature-set"] = m["featureSet"]
r["solana-core"] = m["solanaCore"]
return r
},
)
if err != nil {
return nil, fmt.Errorf("failed to reply: %w", err)
}
return nil, nil
}
2 changes: 2 additions & 0 deletions multiepoch.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ func (ser *MultiEpoch) handleRequest(ctx context.Context, conn *requestContext,
return ser.handleGetTransaction(ctx, conn, req)
case "getSignaturesForAddress":
return ser.handleGetSignaturesForAddress(ctx, conn, req)
case "getVersion":
return ser.handleGetVersion(ctx, conn, req)
default:
return &jsonrpc2.Error{
Code: jsonrpc2.CodeMethodNotFound,
Expand Down
5 changes: 5 additions & 0 deletions storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ type GetTransactionResponse struct {
Signatures []solana.Signature `json:"-"` // TODO: enable this
}

type GetVersionResponse struct {
FeatureSet uint64 `json:"feature-set"`
SolanaCore string `json:"solana-core"`
}

func loadDataFromDataFrames(
firstDataFrame *ipldbindcode.DataFrame,
dataFrameGetter func(ctx context.Context, wantedCid cid.Cid) (*ipldbindcode.DataFrame, error),
Expand Down

0 comments on commit 658be27

Please sign in to comment.