From 64e20508e0b736a873a01a203779fce198db3828 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 14 Nov 2019 16:07:15 +0300 Subject: [PATCH] vm: use hex for ByteArray JSON marshallization It's way more convenient for different purposes. --- pkg/vm/stack_item.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/vm/stack_item.go b/pkg/vm/stack_item.go index c2faabf0f..4b13c12ee 100644 --- a/pkg/vm/stack_item.go +++ b/pkg/vm/stack_item.go @@ -2,6 +2,7 @@ package vm import ( "encoding/binary" + "encoding/hex" "encoding/json" "fmt" "math/big" @@ -197,7 +198,7 @@ func (i *ByteArrayItem) Value() interface{} { // MarshalJSON implements the json.Marshaler interface. func (i *ByteArrayItem) MarshalJSON() ([]byte, error) { - return json.Marshal(string(i.value)) + return json.Marshal(hex.EncodeToString(i.value)) } func (i *ByteArrayItem) String() string {