From 50835a00b073f421d0e32d9d6a9487a04219260d Mon Sep 17 00:00:00 2001 From: rene <41963722+renaynay@users.noreply.github.com> Date: Fri, 22 Apr 2022 11:40:01 +0100 Subject: [PATCH] unmarshal fields --- service/state/pfd_test.go | 7 +++++-- service/state/rpc.go | 15 +++------------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/service/state/pfd_test.go b/service/state/pfd_test.go index e379e1e7b3..db4728742b 100644 --- a/service/state/pfd_test.go +++ b/service/state/pfd_test.go @@ -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 { diff --git a/service/state/rpc.go b/service/state/rpc.go index 016a093a31..f233d034de 100644 --- a/service/state/rpc.go +++ b/service/state/rpc.go @@ -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)