forked from TrueCloudLab/neoneo-go
b77e533d13
And drop associated _pkg.dev remnants (refs. #307). Original `dev` branch had two separate packages for public and private keys, but those are so intertwined (`TestHelper` subpackage is a proof) that it's better unite them and all associated code (like WIF and NEP-2) in one package. This patch also: * creates internal `keytestcases` package to share things with wallet (maybe it'll be changed in some future) * ports some tests from `dev` * ports Verify() method for public key from `dev` * expands TestPrivateKey() with public key check
28 lines
890 B
Go
28 lines
890 B
Go
package transaction
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/CityOfZion/neo-go/pkg/crypto/keys"
|
|
)
|
|
|
|
// 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
|
|
PublicKey *keys.PublicKey
|
|
}
|
|
|
|
// DecodeBinary implements the Payload interface.
|
|
func (tx *EnrollmentTX) DecodeBinary(r io.Reader) error {
|
|
tx.PublicKey = &keys.PublicKey{}
|
|
return tx.PublicKey.DecodeBinary(r)
|
|
}
|
|
|
|
// EncodeBinary implements the Payload interface.
|
|
func (tx *EnrollmentTX) EncodeBinary(w io.Writer) error {
|
|
return tx.PublicKey.EncodeBinary(w)
|
|
}
|