diff --git a/server/jsonrpc_claimtrie.go b/server/jsonrpc_claimtrie.go new file mode 100644 index 0000000..a8ef42b --- /dev/null +++ b/server/jsonrpc_claimtrie.go @@ -0,0 +1,27 @@ +package server + +import ( + "github.com/lbryio/herald.go/db" + pb "github.com/lbryio/herald.go/protobuf/go" + log "github.com/sirupsen/logrus" +) + +type ClaimtrieService struct { + DB *db.ReadOnlyDBColumnFamily +} + +type ResolveData struct { + Data []string `json:"data"` +} + +type Result struct { + Data string `json:"data"` +} + +// Resolve is the json rpc endpoint for 'blockchain.claimtrie.resolve'. +func (t *ClaimtrieService) Resolve(args *ResolveData, result **pb.Outputs) error { + log.Println("Resolve") + res, err := InternalResolve(args.Data, t.DB) + *result = res + return err +} diff --git a/server/jsonrpc_service.go b/server/jsonrpc_service.go index c13fbcb..0f91843 100644 --- a/server/jsonrpc_service.go +++ b/server/jsonrpc_service.go @@ -8,31 +8,9 @@ import ( gorilla_mux "github.com/gorilla/mux" gorilla_rpc "github.com/gorilla/rpc" gorilla_json "github.com/gorilla/rpc/json" - "github.com/lbryio/herald.go/db" - pb "github.com/lbryio/herald.go/protobuf/go" log "github.com/sirupsen/logrus" ) -type ClaimtrieService struct { - DB *db.ReadOnlyDBColumnFamily -} - -type ResolveData struct { - Data []string `json:"data"` -} - -type Result struct { - Data string `json:"data"` -} - -// Resolve is the json rpc endpoint for 'blockchain.claimtrie.resolve'. -func (t *ClaimtrieService) Resolve(r *http.Request, args *ResolveData, result **pb.Outputs) error { - log.Println("Resolve") - res, err := InternalResolve(args.Data, t.DB) - *result = res - return err -} - type gorillaRpcCodec struct { gorilla_rpc.Codec } @@ -79,7 +57,7 @@ func (s *Server) StartJsonRPC() error { // Register "blockchain.claimtrie.*"" handlers. claimtrieSvc := &ClaimtrieService{s.DB} - err := s1.RegisterService(claimtrieSvc, "blockchain_claimtrie") + err := s1.RegisterTCPService(claimtrieSvc, "blockchain_claimtrie") if err != nil { log.Errorf("RegisterService: %v\n", err) }