diff --git a/routing/state.go b/routing/state.go index b9fc759..c626685 100644 --- a/routing/state.go +++ b/routing/state.go @@ -1,7 +1,6 @@ package routing import ( - "bytes" "errors" "github.com/gogo/protobuf/proto" "github.com/libp2p/go-libp2p-core/crypto" @@ -84,9 +83,6 @@ func UnmarshalSignedRoutingState(envelopeBytes []byte) (*SignedRoutingState, err // Fails if the signature is invalid, if the envelope has an unexpected payload type, // or if deserialization of the envelope payload fails. func SignedRoutingStateFromEnvelope(envelope *crypto.SignedEnvelope) (*SignedRoutingState, error) { - if bytes.Compare(envelope.PayloadType, StateEnvelopePayloadType) != 0 { - return nil, errors.New("unexpected envelope payload type") - } var msg pb.RoutingStateRecord err := proto.Unmarshal(envelope.Payload, &msg) if err != nil { diff --git a/routing/state_test.go b/routing/state_test.go index ea21588..bc218a8 100644 --- a/routing/state_test.go +++ b/routing/state_test.go @@ -35,15 +35,4 @@ func TestSignedRoutingStateFromEnvelope(t *testing.T) { _, err = UnmarshalSignedRoutingState(envBytes) test.ExpectError(t, err, "unwrapping RoutingState from envelope should fail if envelope was created with wrong domain string") }) - - t.Run("unwrapping from signed envelope fails if envelope has wrong payload type", func(t *testing.T) { - stateBytes, err := state.Marshal() - test.AssertNilError(t, err) - payloadType := []byte("wrong-payload-type") - env, err := crypto.MakeEnvelope(priv, StateEnvelopeDomain, payloadType, stateBytes) - test.AssertNilError(t, err) - envBytes, err := env.Marshal() - _, err = UnmarshalSignedRoutingState(envBytes) - test.ExpectError(t, err, "unwrapping RoutingState from envelope should fail if envelope was created with wrong payload type") - }) }