mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-25 13:56:35 +00:00
30 lines
607 B
Go
30 lines
607 B
Go
|
package transaction
|
||
|
|
||
|
import (
|
||
|
"io"
|
||
|
|
||
|
"github.com/CityOfZion/neo-go/pkg/util"
|
||
|
)
|
||
|
|
||
|
// StateTX represents a state transaction.
|
||
|
type StateTX struct {
|
||
|
Descriptors []*StateDescriptor
|
||
|
}
|
||
|
|
||
|
// DecodeBinary implements the Payload interface.
|
||
|
func (tx *StateTX) DecodeBinary(r io.Reader) error {
|
||
|
lenDesc := util.ReadVarUint(r)
|
||
|
for i := 0; i < int(lenDesc); i++ {
|
||
|
tx.Descriptors[i] = &StateDescriptor{}
|
||
|
if err := tx.Descriptors[i].DecodeBinary(r); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// EncodeBinary implements the Payload interface.
|
||
|
func (tx *StateTX) EncodeBinary(w io.Writer) error {
|
||
|
return nil
|
||
|
}
|