block

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncorrectRollbackHash = errors.New("Rollback hash doesn't match")
	ErrEmptyBlock            = errors.New("Block doesn't contain transactions")
	ErrIncorrectBlockTime    = utils.WithBan(errors.New("Incorrect block time"))
)

Functions

func GetBlockHeaderFromBlockChain

func GetBlockHeaderFromBlockChain(blockID int64) (*types.BlockHeader, error)

GetBlockHeaderFromBlockChain is retrieving block data from blockchain

func GetDataFromFirstBlock

func GetDataFromFirstBlock() (data *types.FirstBlock, ok bool)

GetDataFromFirstBlock returns data of first block

func GetRollbacksHashWithDiffArr

func GetRollbacksHashWithDiffArr(dbTx *sqldb.DbTransaction, bId int64) ([]byte, error)

func InsertBlockWOForksNew

func InsertBlockWOForksNew(data []byte, classifyTxsMap map[int][]*transaction.Transaction, genBlock, firstBlock bool) error

InsertBlockWOForks is inserting blocks

func MarshallBlock

func MarshallBlock(opts ...types.BlockDataOption) ([]byte, error)

Types

type AfterTxs

type AfterTxs struct {
	UsedTx      [][]byte
	Rts         []*sqldb.RollbackTx
	Lts         []*sqldb.LogTransaction
	UpdTxStatus []*pbgo.TxResult
}

type Block

type Block struct {
	*types.BlockData
	PrevRollbacksHash []byte
	Transactions      []*transaction.Transaction
	GenBlock          bool // it equals true when we are generating a new block
	Notifications     []types.Notifications
	OutputsMap        map[sqldb.KeyUTXO][]sqldb.SpentInfo
	ClassifyTxsMap    map[int][]*transaction.Transaction
	PrevSysPar        map[string]string
	EcoParams         []sqldb.EcoParam // combustion percent,digits for each ecosystem
}

Block is storing block data

func ProcessBlockByBinData

func ProcessBlockByBinData(data []byte, checkSize bool) (*Block, error)

ProcessBlockByBinData is processing block with in table previous block

func UnmarshallBlock

func UnmarshallBlock(blockBuffer *bytes.Buffer, fill bool) (*Block, error)

func (*Block) AfterPlayTxs

func (b *Block) AfterPlayTxs(dbTx *sqldb.DbTransaction) error

func (*Block) Check

func (b *Block) Check() error

Check is checking block

func (*Block) CheckSign

func (b *Block) CheckSign() error

func (*Block) GenAfterTxs

func (b *Block) GenAfterTxs() *AfterTxs

func (*Block) GetLogger

func (b *Block) GetLogger() *log.Entry

GetLogger is returns logger

func (*Block) GetRollbacksHash

func (b *Block) GetRollbacksHash(dbTx *sqldb.DbTransaction) ([]byte, error)

func (*Block) InsertIntoBlockchain

func (b *Block) InsertIntoBlockchain(dbTx *sqldb.DbTransaction) error

InsertIntoBlockchain inserts a block into the blockchain

func (*Block) IsGenesis

func (b *Block) IsGenesis() bool

func (*Block) PlaySafe

func (b *Block) PlaySafe() error

PlaySafe is inserting block safely

func (*Block) ProcessTxs

func (b *Block) ProcessTxs(dbTx *sqldb.DbTransaction) (err error)

Jump to

Keyboard shortcuts

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