Documentation ¶
Index ¶
- Variables
- func GetBlockDataFromBlockChain(blockID int64) (*utils.BlockData, error)
- func GetDataFromFirstBlock() (data *consts.FirstBlock, ok bool)
- func InsertBlockWOForks(data []byte, genBlock, firstBlock bool) error
- func InsertIntoBlockchain(transaction *model.DbTransaction, block *Block) error
- func MarshallBlock(header *utils.BlockData, trData [][]byte, prevHash []byte, key string) ([]byte, error)
- func UpdBlockInfo(dbTransaction *model.DbTransaction, block *Block) error
- type Block
- type Limiter
- type Limits
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrLimitSkip returns when tx should be skipped during generating block ErrLimitSkip = errors.New(`skip tx`) // ErrLimitStop returns when the generation of the block should be stopped ErrLimitStop = errors.New(`stop generating block`) // ErrLimitTime returns when the time limit exceeded ErrLimitTime = errors.New(`Time limit exceeded`) )
Functions ¶
func GetBlockDataFromBlockChain ¶
GetBlockDataFromBlockChain is retrieving block data from blockchain
func GetDataFromFirstBlock ¶
func GetDataFromFirstBlock() (data *consts.FirstBlock, ok bool)
GetDataFromFirstBlock returns data of first block
func InsertBlockWOForks ¶
InsertBlockWOForks is inserting blocks
func InsertIntoBlockchain ¶
func InsertIntoBlockchain(transaction *model.DbTransaction, block *Block) error
InsertIntoBlockchain inserts a block into the blockchain
func MarshallBlock ¶
func MarshallBlock(header *utils.BlockData, trData [][]byte, prevHash []byte, key string) ([]byte, error)
MarshallBlock is marshalling block
func UpdBlockInfo ¶
func UpdBlockInfo(dbTransaction *model.DbTransaction, block *Block) error
UpdBlockInfo updates info_block table
Types ¶
type Block ¶
type Block struct { Header utils.BlockData PrevHeader *utils.BlockData MrklRoot []byte BinData []byte Transactions []*transaction.Transaction SysUpdate bool GenBlock bool // it equals true when we are generating a new block StopCount int // The count of good tx in the block }
Block is storing block data
func ProcessBlockWherePrevFromBlockchainTable ¶
ProcessBlockWherePrevFromBlockchainTable is processing block with in table previous block
func UnmarshallBlock ¶
type Limiter ¶
type Limiter interface {
// contains filtered or unexported methods
}
Limiter describes interface functions for limits
type Limits ¶
type Limits struct { Mode int Block *Block // it equals nil if checking before generatin block Limiters []Limiter // the list of limiters }
Limits is used for saving current limit information
func (*Limits) CheckLimit ¶
func (limits *Limits) CheckLimit(t *transaction.Transaction) error
CheckLimit calls each limiter
Click to show internal directories.
Click to hide internal directories.