transaction

package
v0.0.0-...-8e17a21 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: GPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicatedTx = errors.New("Duplicated transaction")
	ErrNotComeTime  = errors.New("Transaction processing time has not come")
	ErrExpiredTime  = errors.New("Transaction processing time is expired")
	ErrEarlyTime    = utils.WithBan(errors.New("Early transaction time"))
	ErrEmptyKey     = utils.WithBan(errors.New("KeyID is empty"))
)

Functions

func CheckLogTx

func CheckLogTx(txHash []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 CreateContract

func CreateContract(contractName string, keyID int64, params map[string]interface{},
	privateKey []byte) error

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(t *Transaction, blockID int64) error

InsertInLogTx is inserting tx in log

func IsContractTransaction

func IsContractTransaction(txType int64) 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 RawTransaction

type RawTransaction struct {
	// contains filtered or unexported fields
}

func (*RawTransaction) Bytes

func (rtx *RawTransaction) Bytes() []byte

func (*RawTransaction) Hash

func (rtx *RawTransaction) Hash() []byte

func (*RawTransaction) Payload

func (rtx *RawTransaction) Payload() []byte

func (*RawTransaction) Signature

func (rtx *RawTransaction) Signature() []byte

func (*RawTransaction) Type

func (rtx *RawTransaction) Type() int64

func (*RawTransaction) Unmarshall

func (rtx *RawTransaction) Unmarshall(buffer *bytes.Buffer) error

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
	TxSignature  []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
	Rand          *rand.Rand
	Notifications types.Notifications
	GenBlock      bool
	TimeLimit     int64

	SmartContract smart.SmartContract
	// contains filtered or unexported fields
}

Transaction is a structure for parsing transactions

func UnmarshallTransaction

func UnmarshallTransaction(buffer *bytes.Buffer, fillData bool) (*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() (resultContract string, flushRollback []smart.FlushInfo, err error)

CallContract calls the contract functions according to the specified flags

func (*Transaction) CallOBSContract

func (t *Transaction) CallOBSContract() (resultContract string, flushRollback []smart.FlushInfo, err error)

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, []smart.FlushInfo, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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