Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( BLOCKCHAIN_PATH string = "./.blockchain" SAVE_FREQ time.Duration = 800 * time.Millisecond )
Functions ¶
This section is empty.
Types ¶
type Blockchain ¶
handle fork (appropriate data structure)
func NewBlockchain ¶
func NewBlockchain(dist map[string]float64) *Blockchain
func (*Blockchain) GetBlockchain ¶
func (bc *Blockchain) GetBlockchain() []*data.Block
returns a copy of the blockchain
func (*Blockchain) GetPrevHash ¶
func (bc *Blockchain) GetPrevHash() string
func (*Blockchain) GetSlot ¶
func (bc *Blockchain) GetSlot() int
func (*Blockchain) Update ¶
func (bc *Blockchain) Update(block *data.Block)
block paramater has already been validated, add to blockchain and handle forks (keeping track of side chains and longest one in them)
type StakeDistribution ¶
func NewStakeDist ¶
func NewStakeDist(total uint64, dist map[string]float64) StakeDistribution
func (*StakeDistribution) Get ¶
func (sd *StakeDistribution) Get(key string) float64
func (*StakeDistribution) Update ¶
func (sd *StakeDistribution) Update(trans data.Transaction) error
func (*StakeDistribution) Valid ¶
func (sd *StakeDistribution) Valid(trans data.Transaction) (bool, error)
type TransPool ¶
type TransPool struct { Pool map[string]*data.Transaction //key is transaction signature Mux sync.Mutex }
func NewTransPool ¶
func NewTransPool() *TransPool
func (*TransPool) Add ¶
func (tp *TransPool) Add(t *data.Transaction)
func (*TransPool) Update ¶
func (tp *TransPool) Update(trans []data.Transaction)
Click to show internal directories.
Click to hide internal directories.