vm: add MarshalJSON to the Stack

To easily dump it in a known format.
This commit is contained in:
Roman Khimov 2019-10-29 18:26:59 +03:00
parent 47f66dfbf3
commit 94776b8a1f
2 changed files with 11 additions and 2 deletions

View file

@ -1,6 +1,7 @@
package vm
import (
"encoding/json"
"fmt"
"math/big"
@ -334,3 +335,8 @@ func (s *Stack) popSigElements() ([][]byte, error) {
}
return elems, nil
}
// MarshalJSON implements JSON marshalling interface.
func (s *Stack) MarshalJSON() ([]byte, error) {
return json.Marshal(stackToArray(s))
}