2018-03-21 16:11:04 +00:00
|
|
|
package transaction
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
|
2019-08-27 13:29:42 +00:00
|
|
|
"github.com/CityOfZion/neo-go/pkg/crypto/keys"
|
2018-03-21 16:11:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// A Enrollment transaction represents an enrollment form, which indicates
|
|
|
|
// that the sponsor of the transaction would like to sign up as a validator.
|
|
|
|
// The way to sign up is: To construct an EnrollmentTransaction type of transaction,
|
|
|
|
// and send a deposit to the address of the PublicKey.
|
|
|
|
// The way to cancel the registration is: Spend the deposit on the address of the PublicKey.
|
|
|
|
type EnrollmentTX struct {
|
|
|
|
// PublicKey of the validator
|
2019-08-27 13:29:42 +00:00
|
|
|
PublicKey *keys.PublicKey
|
2018-03-21 16:11:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// DecodeBinary implements the Payload interface.
|
|
|
|
func (tx *EnrollmentTX) DecodeBinary(r io.Reader) error {
|
2019-08-27 13:29:42 +00:00
|
|
|
tx.PublicKey = &keys.PublicKey{}
|
2018-03-21 16:11:04 +00:00
|
|
|
return tx.PublicKey.DecodeBinary(r)
|
|
|
|
}
|
|
|
|
|
|
|
|
// EncodeBinary implements the Payload interface.
|
|
|
|
func (tx *EnrollmentTX) EncodeBinary(w io.Writer) error {
|
|
|
|
return tx.PublicKey.EncodeBinary(w)
|
|
|
|
}
|
2019-08-30 08:28:30 +00:00
|
|
|
|
|
|
|
func (tx *EnrollmentTX) Size() int {
|
|
|
|
return len(tx.PublicKey.Bytes())
|
|
|
|
}
|