2019-11-28 16:06:09 +00:00
|
|
|
package state
|
2019-11-25 17:39:11 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/CityOfZion/neo-go/pkg/io"
|
|
|
|
)
|
|
|
|
|
|
|
|
// StorageItem is the value to be stored with read-only flag.
|
|
|
|
type StorageItem struct {
|
|
|
|
Value []byte
|
|
|
|
IsConst bool
|
|
|
|
}
|
|
|
|
|
|
|
|
// EncodeBinary implements Serializable interface.
|
|
|
|
func (si *StorageItem) EncodeBinary(w *io.BinWriter) {
|
|
|
|
w.WriteVarBytes(si.Value)
|
2019-12-12 15:52:23 +00:00
|
|
|
w.WriteBool(si.IsConst)
|
2019-11-25 17:39:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// DecodeBinary implements Serializable interface.
|
|
|
|
func (si *StorageItem) DecodeBinary(r *io.BinReader) {
|
|
|
|
si.Value = r.ReadVarBytes()
|
2019-12-12 15:52:23 +00:00
|
|
|
si.IsConst = r.ReadBool()
|
2019-11-25 17:39:11 +00:00
|
|
|
}
|