Skip to content

Commit

Permalink
unmarshal fields
Browse files Browse the repository at this point in the history
  • Loading branch information
renaynay committed Apr 22, 2022
1 parent c1d419d commit 50835a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
7 changes: 5 additions & 2 deletions service/state/pfd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ func TestService_SubmitPayForData(t *testing.T) {
}

func TestRene(t *testing.T) {
t.Logf("%x", []byte{0, 0, 1, 0, 0, 0, 0, 0})
t.Logf("%x", []byte("hello"))
blah := submitPFDRequest{
NamespaceID: string([]byte{0, 0, 1, 0, 0, 0, 1, 0}),
Data: "hello",
}
t.Logf("%X", blah)
}

func setupKeyring(t *testing.T) *apptypes.KeyringSigner {
Expand Down
15 changes: 3 additions & 12 deletions service/state/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,9 @@ func (s *Service) handleSubmitPFD(w http.ResponseWriter, r *http.Request) {
log.Errorw("serving /submit_pfd request", "err", err)
return
}
nID, err := hex.DecodeString(req.NamespaceID)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
log.Errorw("serving /submit_pfd request", "err", err)
return
}
data, err := hex.DecodeString(req.Data)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
log.Errorw("serving /submit_pfd request", "err", err)
return
}

nID := []byte(req.NamespaceID)
data := []byte(req.Data)

// perform request
txResp, err := s.SubmitPayForData(r.Context(), nID, data)
Expand Down

0 comments on commit 50835a0

Please sign in to comment.