2018-03-04 13:56:49 +00:00
|
|
|
package transaction
|
|
|
|
|
|
|
|
import (
|
2019-09-16 09:18:13 +00:00
|
|
|
"github.com/CityOfZion/neo-go/pkg/io"
|
2018-03-04 13:56:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// ClaimTX represents a claim transaction.
|
|
|
|
type ClaimTX struct {
|
|
|
|
Claims []*Input
|
|
|
|
}
|
|
|
|
|
2019-09-16 16:31:49 +00:00
|
|
|
// DecodeBinary implements Serializable interface.
|
|
|
|
func (tx *ClaimTX) DecodeBinary(br *io.BinReader) {
|
2019-08-28 16:27:06 +00:00
|
|
|
lenClaims := br.ReadVarUint()
|
2018-03-04 13:56:49 +00:00
|
|
|
tx.Claims = make([]*Input, lenClaims)
|
|
|
|
for i := 0; i < int(lenClaims); i++ {
|
|
|
|
tx.Claims[i] = &Input{}
|
2019-09-16 16:31:49 +00:00
|
|
|
tx.Claims[i].DecodeBinary(br)
|
2018-03-04 13:56:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-16 16:31:49 +00:00
|
|
|
// EncodeBinary implements Serializable interface.
|
|
|
|
func (tx *ClaimTX) EncodeBinary(bw *io.BinWriter) {
|
2019-08-28 16:27:06 +00:00
|
|
|
bw.WriteVarUint(uint64(len(tx.Claims)))
|
2018-03-04 13:56:49 +00:00
|
|
|
for _, claim := range tx.Claims {
|
2019-09-16 16:31:49 +00:00
|
|
|
claim.EncodeBinary(bw)
|
2018-03-04 13:56:49 +00:00
|
|
|
}
|
|
|
|
}
|