pkg: hide it by moving to _pkg.dev
The idea here is to preserve the history of `dev` branch development and its code when merging with the `master`. Later this code could be moved into the masters code where appropriate.
This commit is contained in:
parent
bb2568cc53
commit
ddd1d92ff1
183 changed files with 0 additions and 0 deletions
43
_pkg.dev/wire/payload/transaction/state.go
Normal file
43
_pkg.dev/wire/payload/transaction/state.go
Normal file
|
@ -0,0 +1,43 @@
|
|||
package transaction
|
||||
|
||||
import (
|
||||
"github.com/CityOfZion/neo-go/pkg/wire/payload/transaction/types"
|
||||
"github.com/CityOfZion/neo-go/pkg/wire/payload/transaction/version"
|
||||
"github.com/CityOfZion/neo-go/pkg/wire/util"
|
||||
)
|
||||
|
||||
//StateTX represents a state transaction on the neo network
|
||||
// XXX: TX postfix here as `state` is ambiguous. We can remove it for consistency
|
||||
type StateTX struct {
|
||||
*Base
|
||||
Descriptors []*StateDescriptor
|
||||
}
|
||||
|
||||
//NewStateTX returns a state transaction
|
||||
func NewStateTX(ver version.TX) *StateTX {
|
||||
basicTrans := createBaseTransaction(types.State, ver)
|
||||
|
||||
StateTX := &StateTX{}
|
||||
StateTX.Base = basicTrans
|
||||
StateTX.encodeExclusive = StateTX.encodeExcl
|
||||
StateTX.decodeExclusive = StateTX.decodeExcl
|
||||
return StateTX
|
||||
}
|
||||
|
||||
func (s *StateTX) encodeExcl(bw *util.BinWriter) {
|
||||
|
||||
bw.VarUint(uint64(len(s.Descriptors)))
|
||||
for _, desc := range s.Descriptors {
|
||||
desc.Encode(bw)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *StateTX) decodeExcl(br *util.BinReader) {
|
||||
lenDesc := br.VarUint()
|
||||
|
||||
s.Descriptors = make([]*StateDescriptor, lenDesc)
|
||||
for i := 0; i < int(lenDesc); i++ {
|
||||
s.Descriptors[i] = &StateDescriptor{}
|
||||
s.Descriptors[i].Decode(br)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue