func (atx *ActivationTx) GetPoetProofRef() Hash32 {
	return BytesToHash(atx.NIPost.PostMetadata.Challenge)
}
GetPoetProofRef returns the reference to the PoET proof.
package types
import (
	"bytes"
	"encoding/hex"
	"fmt"
	"sort"
	"strconv"
	poetShared "github.com/spacemeshos/poet/shared"
	postShared "github.com/spacemeshos/post/shared"
	"github.com/spacemeshos/sha256-simd"
	"github.com/spacemeshos/go-spacemesh/common/util"
	"github.com/spacemeshos/go-spacemesh/log"
)
type EpochID uint32
func (l EpochID) ToBytes() []byte { return util.Uint32ToBytes(uint32(l)) }
func (l EpochID) IsGenesis() bool {
	return l < 2
}
func (l EpochID) NeedsGoldenPositioningATX() bool {
	return l == 1
}
func (l EpochID) FirstLayer() LayerID {
	return NewLayerID(uint32(l)).Mul(getLayersPerEpoch())
}
func (l EpochID) Field() log.Field { return log.Uint32("epoch_id", uint32(l)) }
func (l EpochID) String() string {
	return strconv.FormatUint(uint64(l), 10)
}
type ATXID Hash32
func (t ATXID) ShortString() string {
	return t.Hash32().ShortString()
}
func (t ATXID) Hash32() Hash32 {
	return Hash32(t)
}
func (t ATXID) Bytes() []byte {
	return Hash32(t).Bytes()
}
func (t ATXID) Field() log.Field { return log.FieldNamed("atx_id", t.Hash32()) }
func (t ATXID) Compare(other ATXID) bool {
	return bytes.Compare(t.Bytes(), other.Bytes()) < 0
}
var EmptyATXID = &ATXID{}
type ActivationTxHeader struct {
	NIPostChallenge
	id       *ATXID  
	Coinbase Address
	NumUnits uint
}
func (atxh *ActivationTxHeader) ShortString() string {
	return atxh.ID().ShortString()
}
func (atxh *ActivationTxHeader) Hash32() Hash32 {
	return atxh.ID().Hash32()
}
func (atxh *ActivationTxHeader) ID() ATXID {
	if atxh.id == nil {
		panic("id field must be set")
	}
	return *atxh.id
}
func (atxh *ActivationTxHeader) TargetEpoch() EpochID {
	return atxh.PubLayerID.GetEpoch() + 1
}
func (atxh *ActivationTxHeader) SetID(id *ATXID) {
	atxh.id = id
}
func (atxh *ActivationTxHeader) GetWeight() uint64 {
	return uint64(atxh.NumUnits) * (atxh.EndTick - atxh.StartTick)
}
type NIPostChallenge struct {
	NodeID             NodeID
	Sequence           uint64
	PrevATXID          ATXID
	PubLayerID         LayerID
	StartTick          uint64
	EndTick            uint64
	PositioningATX     ATXID
	InitialPostIndices []byte
}
func (challenge *NIPostChallenge) Hash() (*Hash32, error) {
	ncBytes, err := NIPostChallengeToBytes(challenge)
	if err != nil {
		return nil, err
	}
	hash := CalcHash32(ncBytes)
	return &hash, nil
}
func (challenge *NIPostChallenge) String() string {
	return fmt.Sprintf("<id: [vrf: %v ed: %v], seq: %v, prevATX: %v, PubLayer: %v, s tick: %v, e tick: %v, "+
		"posATX: %v>",
		util.Bytes2Hex(challenge.NodeID.VRFPublicKey)[:5],
		challenge.NodeID.ShortString(),
		challenge.Sequence,
		challenge.PrevATXID.ShortString(),
		challenge.PubLayerID,
		challenge.StartTick,
		challenge.EndTick,
		challenge.PositioningATX.ShortString())
}
type InnerActivationTx struct {
	*ActivationTxHeader
	NIPost      *NIPost
	InitialPost *Post
}
type ActivationTx struct {
	*InnerActivationTx
	Sig []byte
}
func NewActivationTx(challenge NIPostChallenge, coinbase Address, nipost *NIPost, numUnits uint, initialPost *Post) *ActivationTx {
	atx := &ActivationTx{
		InnerActivationTx: &InnerActivationTx{
			ActivationTxHeader: &ActivationTxHeader{
				NIPostChallenge: challenge,
				Coinbase:        coinbase,
				NumUnits:        numUnits,
			},
			NIPost:      nipost,
			InitialPost: initialPost,
		},
	}
	atx.CalcAndSetID()
	return atx
}
func (atx *ActivationTx) InnerBytes() ([]byte, error) {
	return InterfaceToBytes(atx.InnerActivationTx)
}
func (atx *ActivationTx) Fields(size int) []log.LoggableField {
	initialPost := ""
	if atx.InitialPost != nil {
		initialPost = atx.InitialPost.String()
	}
	challenge := ""
	h, err := atx.NIPostChallenge.Hash()
	if err == nil && h != nil {
		challenge = h.String()
	}
	return []log.LoggableField{
		atx.ID(),
		log.FieldNamed("sender_id", atx.NodeID),
		log.FieldNamed("prev_atx_id", atx.PrevATXID),
		log.FieldNamed("pos_atx_id", atx.PositioningATX),
		log.FieldNamed("coinbase", atx.Coinbase),
		atx.PubLayerID,
		atx.PubLayerID.GetEpoch(),
		log.Uint64("num_units", uint64(atx.NumUnits)),
		log.Uint64("start_tick", atx.StartTick),
		log.Uint64("end_tick", atx.EndTick),
		log.Uint64("weight", atx.GetWeight()),
		log.Uint64("sequence_number", atx.Sequence),
		log.String("NIPostChallenge", challenge),
		log.String("initialPost", initialPost),
		log.Int("atx_size", size),
	}
}
func (atx *ActivationTx) CalcAndSetID() {
	id := ATXID(CalcATXHash32(atx))
	atx.SetID(&id)
}