Documentation
¶
Index ¶
- Variables
- func BlockRollback(data []byte) error
- func CheckLogTx(txBinary []byte, transactions, txQueue bool) error
- func CheckTransaction(data []byte) (*tx.Header, error)
- func ClearTmp(blocks map[int64]string)
- func GetBlockDataFromBlockChain(blockID int64) (*utils.BlockData, error)
- func GetBlocks(blockID int64, host string) error
- func GetKeyIDFromPrivateKey() (int64, error)
- func GetTablePrefix(global string, stateId int64) (string, error)
- func GetTxTypeAndUserID(binaryBlock []byte) (txType int64, keyID int64)
- func InsertBlockWOForks(data []byte) error
- func InsertInLogTx(transaction *model.DbTransaction, binaryTx []byte, time int64) error
- func InsertIntoBlockchain(transaction *model.DbTransaction, block *Block) error
- func IsContractTransaction(txType int) bool
- func IsState(transaction *model.DbTransaction, country string) (int64, error)
- func MarshallBlock(header *utils.BlockData, trData [][]byte, prevHash []byte, key string) ([]byte, error)
- func ParseBlockHeader(binaryBlock *bytes.Buffer) (utils.BlockData, error)
- func RollbackTxFromBlock(data []byte) error
- func UpdBlockInfo(dbTransaction *model.DbTransaction, block *Block) error
- type Block
- type FirstBlockParser
- type Parser
- func (p *Parser) AccessChange(table, name, global string, stateId int64) error
- func (p *Parser) AccessRights(condition string, iscondition bool) error
- func (p *Parser) AllTxParser() error
- func (p *Parser) BlockError(err error)
- func (p *Parser) CallContract(flags int) (resultContract string, err error)
- func (p *Parser) DeleteQueueTx(hash []byte) error
- func (p *Parser) ErrInfo(verr interface{}) error
- func (p *Parser) FormatBlockData() string
- func (p *Parser) FormatTxMap() string
- func (p Parser) GetLogger() *log.Entry
- func (p *Parser) RollbackToBlockID(blockID int64) error
- func (p *Parser) TxParser(hash, binaryTx []byte, myTx bool) error
- type ParserInterface
Constants ¶
This section is empty.
Variables ¶
var ErrFirstBlockHostIsEmpty = errors.New("FirstBlockHost is empty")
ErrFirstBlockHostIsEmpty host for first block is not specified
Functions ¶
func CheckLogTx ¶
CheckLogTx checks if this transaction exists And it would have successfully passed a frontal test
func CheckTransaction ¶
CheckTransaction is checking transaction
func GetBlockDataFromBlockChain ¶
GetBlockDataFromBlockChain is retrieving block data from blockchain
func GetKeyIDFromPrivateKey ¶
GetKeyIDFromPrivateKey load KeyID fron PrivateKey file
func GetTablePrefix ¶
GetTablePrefix returns table prefix
func GetTxTypeAndUserID ¶
GetTxTypeAndUserID returns tx type, wallet and citizen id from the block data
func InsertBlockWOForks ¶
InsertBlockWOForks is inserting blocks
func InsertInLogTx ¶
func InsertInLogTx(transaction *model.DbTransaction, binaryTx []byte, time int64) error
InsertInLogTx is inserting tx in log
func InsertIntoBlockchain ¶
func InsertIntoBlockchain(transaction *model.DbTransaction, block *Block) error
InsertIntoBlockchain inserts a block into the blockchain
func IsContractTransaction ¶
IsContractTransaction checks txType
func IsState ¶
func IsState(transaction *model.DbTransaction, country string) (int64, error)
IsState returns if country is state
func MarshallBlock ¶
func MarshallBlock(header *utils.BlockData, trData [][]byte, prevHash []byte, key string) ([]byte, error)
MarshallBlock is marshalling block
func ParseBlockHeader ¶
ParseBlockHeader is parses block header
func RollbackTxFromBlock ¶
RollbackTxFromBlock is rollback tx from 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 Parsers []*Parser SysUpdate bool }
Block is storing block data
func ProcessBlockWherePrevFromBlockchainTable ¶
ProcessBlockWherePrevFromBlockchainTable is processing block with in table previous block
func ProcessBlockWherePrevFromMemory ¶
ProcessBlockWherePrevFromMemory is processing block with in memory previous block
func (*Block) PlayBlockSafe ¶
PlayBlockSafe is inserting block safely
type FirstBlockParser ¶
type FirstBlockParser struct {
*Parser
}
FirstBlockParser is parser wrapper
func (*FirstBlockParser) Action ¶
func (p *FirstBlockParser) Action() error
Action is fires first block
func (FirstBlockParser) Header ¶
func (p FirstBlockParser) Header() *tx.Header
Header is returns first block header
func (*FirstBlockParser) Rollback ¶
func (p *FirstBlockParser) Rollback() error
Rollback first block
func (*FirstBlockParser) Validate ¶
func (p *FirstBlockParser) Validate() error
Validate first block
type Parser ¶
type Parser struct { BlockData *utils.BlockData PrevBlock *utils.BlockData CurrentVersion string MrklRoot []byte PublicKeys [][]byte TxBinaryData []byte // transaction binary data TxFullData []byte // full transaction, with type and data TxHash []byte TxSlice [][]byte TxMap map[string][]byte TxIds int // count of transactions TxKeyID int64 TxEcosystemIDStr string TxEcosystemID int64 TxNodePosition uint32 TxTime int64 TxType int64 TxCost int64 // Maximum cost of executing contract TxUsedCost decimal.Decimal // Used cost of CPU resources TxPtr interface{} // Pointer to the corresponding struct in consts/struct.go TxData map[string]interface{} TxSmart *tx.SmartContract TxContract *smart.Contract TxHeader *tx.Header DbTransaction *model.DbTransaction SysUpdate bool SmartContract smart.SmartContract // contains filtered or unexported fields }
Parser is a structure for parsing transactions
func ParseTransaction ¶
ParseTransaction is parsing transaction
func (*Parser) AccessChange ¶
AccessChange is changing access
func (*Parser) AccessRights ¶
AccessRights checks the access right by executing the condition value
func (*Parser) AllTxParser ¶
AllTxParser parses new transactions
func (*Parser) BlockError ¶
BlockError writes the error of the transaction in the transactions_status table
func (*Parser) CallContract ¶
CallContract calls the contract functions according to the specified flags
func (*Parser) DeleteQueueTx ¶
DeleteQueueTx deletes a transaction from the queue
func (*Parser) FormatBlockData ¶
FormatBlockData returns formated block data
func (*Parser) FormatTxMap ¶
FormatTxMap returns the formated TxMap
func (*Parser) RollbackToBlockID ¶
RollbackToBlockID rollbacks blocks till blockID