consensus

package
v0.0.0-...-97f3c37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateLeader

func ValidateLeader(slot int, nonce string, public string, vrfProof string, stakeDist *blockchain.StakeDistribution) bool

quick validation for supposed mined block that node received from network determines whether network will broadcast this block further or not

Types

type Consensus

type Consensus struct {
	ChanNetBlock        <-chan data.Block
	ChanNetTransaction  <-chan data.Transaction
	ChanConsBlock       chan<- data.Block
	ChanConsTransaction chan<- data.Transaction

	Blockchain *blockchain.Blockchain
	TransPool  *blockchain.TransPool

	PrivateKey ed25519.PrivateKey
	// contains filtered or unexported fields
}

func (*Consensus) CreateBlock

func (c *Consensus) CreateBlock()

func (*Consensus) HasEnoughMoney

func (c *Consensus) HasEnoughMoney(user string, amount float64) bool

func (*Consensus) Init

func (c *Consensus) Init() error

func (*Consensus) SendTransaction

func (c *Consensus) SendTransaction(t data.Transaction)

validate without the sign

func (*Consensus) TransactionsForBlock

func (c *Consensus) TransactionsForBlock() []data.Transaction

necessary as some transactions could be from same user and could potentially cause wrong valadation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL