diff --git a/pkg/core/transaction/state_descriptor.go b/pkg/core/transaction/state_descriptor.go index a839d17d2..05f0a7f12 100644 --- a/pkg/core/transaction/state_descriptor.go +++ b/pkg/core/transaction/state_descriptor.go @@ -26,14 +26,14 @@ func (s *StateDescriptor) DecodeBinary(r *io.BinReader) { s.Type = DescStateType(r.ReadB()) s.Key = r.ReadVarBytes() - s.Value = r.ReadVarBytes() s.Field = r.ReadString() + s.Value = r.ReadVarBytes() } // EncodeBinary implements Serializable interface. func (s *StateDescriptor) EncodeBinary(w *io.BinWriter) { w.WriteB(byte(s.Type)) w.WriteVarBytes(s.Key) - w.WriteVarBytes(s.Value) w.WriteString(s.Field) + w.WriteVarBytes(s.Value) } diff --git a/pkg/core/transaction/state_test.go b/pkg/core/transaction/state_test.go index 0c01406cd..53fb17e7c 100644 --- a/pkg/core/transaction/state_test.go +++ b/pkg/core/transaction/state_test.go @@ -25,8 +25,8 @@ func TestEncodeDecodeState(t *testing.T) { assert.Equal(t, 1, len(s.Descriptors)) descriptor := s.Descriptors[0] assert.Equal(t, "03c089d7122b840a4935234e82e26ae5efd0c2acb627239dc9f207311337b6f2c1", hex.EncodeToString(descriptor.Key)) - assert.Equal(t, "52656769737465726564", hex.EncodeToString(descriptor.Value)) - assert.Equal(t, "\x01", descriptor.Field) + assert.Equal(t, "Registered", descriptor.Field) + assert.Equal(t, []byte{0x01}, descriptor.Value) assert.Equal(t, Validator, descriptor.Type) // Encode