vm: add MarshalJSON to the Stack
To easily dump it in a known format.
This commit is contained in:
parent
47f66dfbf3
commit
94776b8a1f
2 changed files with 11 additions and 2 deletions
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue