func (sn *Node) FinalState() [6]byte {
	return sn.finalState
}
FinalState returns the final state lottery checksum of the node.
package stake
import (
	"fmt"
	"github.com/HcashOrg/hcashd/blockchain/stake/internal/dbnamespace"
	"github.com/HcashOrg/hcashd/blockchain/stake/internal/ticketdb"
	"github.com/HcashOrg/hcashd/blockchain/stake/internal/tickettreap"
	"github.com/HcashOrg/hcashd/chaincfg"
	"github.com/HcashOrg/hcashd/chaincfg/chainhash"
	"github.com/HcashOrg/hcashd/database"
	"github.com/HcashOrg/hcashd/wire"
	"math/big"
)
type UndoTicketDataSlice []ticketdb.UndoTicketData
type Node struct {
	height uint32
	keyHeight uint32
	liveTickets *tickettreap.Immutable
	missedTickets *tickettreap.Immutable
	revokedTickets *tickettreap.Immutable
	databaseUndoUpdate UndoTicketDataSlice
	databaseBlockTickets ticketdb.TicketHashes
	nextWinners []chainhash.Hash
	finalState [6]byte
	params *chaincfg.Params
}
func (sn *Node) UndoData() UndoTicketDataSlice {
	return sn.databaseUndoUpdate
}
func (sn *Node) NewTickets() []chainhash.Hash {
	return sn.databaseBlockTickets
}
func (sn *Node) SpentByBlock() []chainhash.Hash {
	var spent []chainhash.Hash
	for _, undo := range sn.databaseUndoUpdate {
		if undo.Spent {
			spent = append(spent, undo.TicketHash)
		}
	}
	return spent
}
func (sn *Node) MissedByBlock() []chainhash.Hash {
	var missed []chainhash.Hash
	for _, undo := range sn.databaseUndoUpdate {
		if undo.Missed {
			missed = append(missed, undo.TicketHash)
		}
	}
	return missed
}
func (sn *Node) ExistsLiveTicket(ticket chainhash.Hash) bool {
	return sn.liveTickets.Has(tickettreap.Key(ticket))
}
func (sn *Node) LiveTickets() []chainhash.Hash {
	tickets := make([]chainhash.Hash, sn.liveTickets.Len())
	i := 0
	sn.liveTickets.ForEach(func(k tickettreap.Key, v *tickettreap.Value) bool {
		tickets[i] = chainhash.Hash(k)
		i++
		return true
	})
	return tickets
}
func (sn *Node) PoolSize() int {
	return sn.liveTickets.Len()
}
func (sn *Node) ExistsMissedTicket(ticket chainhash.Hash) bool {
	return sn.missedTickets.Has(tickettreap.Key(ticket))
}
func (sn *Node) MissedTickets() []chainhash.Hash {
	tickets := make([]chainhash.Hash, sn.missedTickets.Len())
	i := 0
	sn.missedTickets.ForEach(func(k tickettreap.Key, v *tickettreap.Value) bool {
		tickets[i] = chainhash.Hash(k)
		i++
		return true
	})
	return tickets
}
func (sn *Node) ExistsRevokedTicket(ticket chainhash.Hash) bool {
	return sn.revokedTickets.Has(tickettreap.Key(ticket))
}
func (sn *Node) RevokedTickets() []*chainhash.Hash {
	tickets := make([]*chainhash.Hash, sn.revokedTickets.Len())
	i := 0
	sn.revokedTickets.ForEach(func(k tickettreap.Key, v *tickettreap.Value) bool {
		h := chainhash.Hash(k)
		tickets[i] = &h
		i++
		return true
	})
	return tickets
}
func (sn *Node) ExistsExpiredTicket(ticket chainhash.Hash) bool {
	v := sn.missedTickets.Get(tickettreap.Key(ticket))
	if v != nil && v.Expired {
		return true
	}
	v = sn.revokedTickets.Get(tickettreap.Key(ticket))
	if v != nil && v.Expired {
		return true
	}
	return false
}
func (sn *Node) Winners() []chainhash.Hash {
	return sn.nextWinners
}