Documentation
¶
Index ¶
- func RandomTransactions(bm *Accounts, numTransactions int, keyPairs []block.KeyPair, vdfValue []byte) (*block.Transactions, uint64)
- func RandomTransactionsBlocks(bm *Accounts, numTransactionsPerBlock int, numBlocks int, ...) []block.Block
- func SignatureVerification(packetReceiver <-chan *network.Packets) <-chan *network.Packets
- func TransactionGenerator(bm *Accounts, packetReceiver <-chan *network.Packets) <-chan *block.Transactions
- type Accounts
- func (bm *Accounts) AddValidVDFValue(val block.VDFValue)
- func (bm *Accounts) Balance(publicKey ed25519.PublicKey) int64
- func (bm *Accounts) BlocksTotal() uint64
- func (bm *Accounts) Clone() *Accounts
- func (bm *Accounts) CreateAccount(publicKey ed25519.PublicKey, amount int64)
- func (bm *Accounts) Equals(bm2 *Accounts) bool
- func (bm *Accounts) IncreaseBlocksTotal()
- func (bm *Accounts) LastBlock() *block.Block
- func (bm *Accounts) ProcessBlocks(blocks []block.Block) (err error)
- func (bm *Accounts) ProcessTransactions(trans block.Transactions) block.Transactions
- func (bm *Accounts) RandomKeys(num uint64) []ed25519.PublicKey
- func (bm *Accounts) String() string
- func (bm *Accounts) TransactionsTotal() uint64
- func (bm *Accounts) UpdateLastBlock(bl *block.Block)
- func (bm *Accounts) ValidVDFValue() []byte
- type Ledger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomTransactions ¶
func RandomTransactions(bm *Accounts, numTransactions int, keyPairs []block.KeyPair, vdfValue []byte) (*block.Transactions, uint64)
RandomTransactions returns random transactions and number of transactions that will be processed successfully. Only for testing!
func RandomTransactionsBlocks ¶
func RandomTransactionsBlocks(bm *Accounts, numTransactionsPerBlock int, numBlocks int, keyPairs []block.KeyPair) []block.Block
RandomTransactionsBlocks generates blocks with random transactions between real accounts, for testing
func SignatureVerification ¶
SignatureVerification accepts Packets verifies them and sends verified only Packets to the output channel
func TransactionGenerator ¶
func TransactionGenerator(bm *Accounts, packetReceiver <-chan *network.Packets) <-chan *block.Transactions
TransactionGenerator is responsible for creating Transactions. It should receive raw data through transactionReceiver channel and deserialize it(implement deserialization later) For now TransactionGenerator receives Transactions.
Types ¶
type Accounts ¶
type Accounts struct {
// contains filtered or unexported fields
}
Accounts stores account balances and ledger info.
func RandomAccounts ¶
RandomAccounts creates bank with random accounts, for testing
func (*Accounts) AddValidVDFValue ¶
AddValidVDFValue adds last seen vdf value to the ledger
func (*Accounts) Balance ¶
Balance method returns balance of account with public key equals publicKey. NOTE: Only for testing.
func (*Accounts) BlocksTotal ¶
BlocksTotal returns count of processed blocks
func (*Accounts) CreateAccount ¶
CreateAccount creates new account with initial balance. NOTE: Only for testing.
func (*Accounts) Equals ¶
Equals compares two Accounts and returns true if they have same accounts with same balances
func (*Accounts) IncreaseBlocksTotal ¶
func (bm *Accounts) IncreaseBlocksTotal()
IncreaseBlocksTotal increases Block Count
func (*Accounts) ProcessBlocks ¶
ProcessBlocks process a list of blocks. TODO: change copying transactions
func (*Accounts) ProcessTransactions ¶
func (bm *Accounts) ProcessTransactions(trans block.Transactions) block.Transactions
ProcessTransactions process a batch of transactions.
func (*Accounts) RandomKeys ¶
RandomKeys returns account keys, which are used as default account list on web monitoring tool
func (*Accounts) TransactionsTotal ¶
TransactionsTotal returns count of transactions
func (*Accounts) UpdateLastBlock ¶
UpdateLastBlock updates last block in ledger and counts number of blocks
func (*Accounts) ValidVDFValue ¶
ValidVDFValue returns the valid vdf value registered.
type Ledger ¶
type Ledger struct {
// contains filtered or unexported fields
}
Ledger struct is responsible to save last vdf values For each VDFValue we store a set of Signatures. This way we can determine which signature came with which VDFValue
func (*Ledger) AddValidVDFValue ¶
AddValidVDFValue registers new vdf value. typically used when producer is sending blocks to the network.
func (*Ledger) UpdateLastBlock ¶
UpdateLastBlock updates last block in ledger. last block means a block with the highest number(height).