2018-01-30 10:56:36 +00:00
|
|
|
package core
|
|
|
|
|
2018-01-31 10:47:54 +00:00
|
|
|
import (
|
|
|
|
"encoding/binary"
|
|
|
|
"io"
|
|
|
|
)
|
|
|
|
|
2018-02-01 18:05:56 +00:00
|
|
|
// Transaction is a process recorded in the NEO system.
|
|
|
|
type Transaction struct {
|
|
|
|
Type TransactionType
|
2018-01-31 10:47:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// All processes in NEO system are recorded in transactions.
|
|
|
|
// There are several types of transactions.
|
|
|
|
const (
|
|
|
|
MinerTX TransactionType = 0x00
|
|
|
|
IssueTX = 0x01
|
|
|
|
ClaimTX = 0x02
|
|
|
|
EnrollmentTX = 0x20
|
|
|
|
VotingTX = 0x24
|
|
|
|
RegisterTX = 0x40
|
|
|
|
ContractTX = 0x80
|
|
|
|
AgencyTX = 0xb0
|
|
|
|
)
|
|
|
|
|
|
|
|
// DecodeBinary implements the payload interface.
|
2018-02-01 18:05:56 +00:00
|
|
|
func (t Transaction) DecodeBinary(r io.Reader) error {
|
2018-01-31 10:47:54 +00:00
|
|
|
err := binary.Read(r, binary.LittleEndian, &t.Type)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// EncodeBinary implements the payload interface.
|
2018-02-01 18:05:56 +00:00
|
|
|
func (t Transaction) EncodeBinary(w io.Writer) error {
|
2018-01-31 10:47:54 +00:00
|
|
|
return nil
|
|
|
|
}
|