transaction

package
v0.0.0-...-5ecede5 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: LGPL-3.0-or-later Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDuplicatedTx = errors.New("Duplicated transaction")

Functions

func CheckLogTx

func CheckLogTx(txBinary []byte, transactions, txQueue bool) error

CheckLogTx checks if this transaction exists And it would have successfully passed a frontal test

func CheckTransaction

func CheckTransaction(data []byte) (*tx.Header, error)

CheckTransaction is checking transaction

func CleanCache

func CleanCache()

CleanCache cleans cache of transaction parsers

func DeleteQueueTx

func DeleteQueueTx(dbTransaction *model.DbTransaction, hash []byte) error

DeleteQueueTx deletes a transaction from the queue

func GetTransaction

func GetTransaction(t *Transaction, txType string) (custom.TransactionInterface, error)

func GetTxTypeAndUserID

func GetTxTypeAndUserID(binaryBlock []byte) (txType int64, keyID int64)

GetTxTypeAndUserID returns tx type, wallet and citizen id from the block data

func InsertInLogTx

func InsertInLogTx(transaction *model.DbTransaction, binaryTx []byte, time int64) error

InsertInLogTx is inserting tx in log

func IsContractTransaction

func IsContractTransaction(txType int) bool

IsContractTransaction checks txType

func MarkTransactionBad

func MarkTransactionBad(dbTransaction *model.DbTransaction, hash []byte, errText string) error

func ProcessQueueTransaction

func ProcessQueueTransaction(dbTransaction *model.DbTransaction, hash, binaryTx []byte, myTx bool) error

TxParser writes transactions into the queue

func ProcessTransactionsQueue

func ProcessTransactionsQueue(dbTransaction *model.DbTransaction) error

AllTxParser parses new transactions

Types

type Transaction

type Transaction struct {
	BlockData  *utils.BlockData
	PrevBlock  *utils.BlockData
	PublicKeys [][]byte

	TxBinaryData []byte // transaction binary data
	TxFullData   []byte // full transaction, with type and data
	TxHash       []byte
	TxKeyID      int64
	TxTime       int64
	TxType       int64
	TxCost       int64 // Maximum cost of executing contract
	TxFuel       int64
	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
}

Transaction is a structure for parsing transactions

func UnmarshallTransaction

func UnmarshallTransaction(buffer *bytes.Buffer) (*Transaction, error)

UnmarshallTransaction is unmarshalling transaction

func (*Transaction) AccessRights

func (t *Transaction) AccessRights(condition string, iscondition bool) error

AccessRights checks the access right by executing the condition value

func (*Transaction) CallContract

func (t *Transaction) CallContract(flags int) (resultContract string, err error)

CallContract calls the contract functions according to the specified flags

func (*Transaction) Check

func (t *Transaction) Check(checkTime int64, checkForDupTr bool) error

func (Transaction) GetLogger

func (t Transaction) GetLogger() *log.Entry

GetLogger returns logger

func (*Transaction) Play

func (t *Transaction) Play() (string, error)

Directories

Path Synopsis
MIT License
MIT License

Jump to

Keyboard shortcuts

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