Documentation ¶
Overview ¶
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
Index ¶
- Variables
- func BadTxForBan(keyID int64)
- func BannedTill(keyID int64) string
- func CheckLogTx(txHash []byte, logger *log.Entry) error
- func CleanCache()
- func CreateContract(contractName string, keyID int64, params map[string]any, privateKey []byte) error
- func CreateDelayTransactionHighRate(data, hash []byte, keyID, highRate int64) *sqldb.Transaction
- func CreateTransaction(data, hash []byte, keyID, tnow int64) error
- func DeleteQueueTx(dbTx *sqldb.DbTransaction, hash []byte) error
- func IsKeyBanned(keyID int64) bool
- func MarkTransactionBad(hash []byte, errText string) error
- func NewInternalTransaction(smartTx types.SmartTransaction, privateKey []byte) (data, hash []byte, err error)
- func NewTransactionInProc(smartTx types.SmartTransaction, privateKey []byte) (data, hash []byte, err error)
- func ProcessQueueTransactionBatches(dbTx *sqldb.DbTransaction, qs []*sqldb.QueueTx) error
- func ProcessTransactionsAttempt(dbTx *sqldb.DbTransaction) error
- func ProcessTransactionsQueue(dbTx *sqldb.DbTransaction) error
- type DeliverProvider
- type FirstBlockParser
- func (f *FirstBlockParser) Action(in *InToCxt, out *OutCtx) (err error)
- func (s *FirstBlockParser) BinMarshal(data *types.FirstBlock) ([]byte, error)
- func (f *FirstBlockParser) FlushVM()
- func (f *FirstBlockParser) Init(in *InToCxt) error
- func (f *FirstBlockParser) SysTableColByteaWorker(dbTx *sqldb.DbTransaction) error
- func (f *FirstBlockParser) SysUpdateWorker(dbTx *sqldb.DbTransaction) error
- func (f *FirstBlockParser) TxRollback() error
- func (f *FirstBlockParser) Unmarshal(buffer *bytes.Buffer) error
- func (f *FirstBlockParser) Validate() error
- type InToCxt
- type LimitMode
- type Limiter
- type Limits
- type OutCtx
- type OutCtxOption
- func WithOutCtxRollBackTx(ret []*types.RollbackTx) OutCtxOption
- func WithOutCtxSysUpdate(ret bool) OutCtxOption
- func WithOutCtxTxInputs(txInputsMap map[sqldb.KeyUTXO][]sqldb.SpentInfo) OutCtxOption
- func WithOutCtxTxOutputs(txOutputsMap map[sqldb.KeyUTXO][]sqldb.SpentInfo) OutCtxOption
- func WithOutCtxTxResult(ret *pbgo.TxResult) OutCtxOption
- type SmartTransactionParser
- func (s *SmartTransactionParser) Action(in *InToCxt, out *OutCtx) (err error)
- func (s *SmartTransactionParser) BinMarshalWithPrivate(smartTx *types.SmartTransaction, privateKey []byte, internal bool) ([]byte, error)
- func (s *SmartTransactionParser) FlushVM()
- func (s *SmartTransactionParser) Init(t *InToCxt) error
- func (s *SmartTransactionParser) Marshal() ([]byte, error)
- func (s *SmartTransactionParser) SysTableColByteaWorker(dbTx *sqldb.DbTransaction) error
- func (s *SmartTransactionParser) SysUpdateWorker(dbTx *sqldb.DbTransaction) error
- func (s *SmartTransactionParser) TxRollback() error
- func (s *SmartTransactionParser) Unmarshal(buffer *bytes.Buffer, fill bool) error
- func (s *SmartTransactionParser) Validate() error
- type StopNetworkParser
- func (s *StopNetworkParser) Action(in *InToCxt, out *OutCtx) (err error)
- func (s *StopNetworkParser) BinMarshal(data *types.StopNetwork) ([]byte, error)
- func (s *StopNetworkParser) FlushVM()
- func (s *StopNetworkParser) Init(in *InToCxt) error
- func (s *StopNetworkParser) SysTableColByteaWorker(dbTx *sqldb.DbTransaction) error
- func (s *StopNetworkParser) SysUpdateWorker(dbTx *sqldb.DbTransaction) error
- func (s *StopNetworkParser) TxRollback() error
- func (s *StopNetworkParser) Unmarshal(buffer *bytes.Buffer) error
- func (s *StopNetworkParser) Validate() error
- type Transaction
- func (tr *Transaction) Apply(opts ...TransactionOption) error
- func (t *Transaction) Check(checkTime int64) error
- func (t *Transaction) Expedite() decimal.Decimal
- func (t *Transaction) GetLogger() *log.Entry
- func (t *Transaction) Hash() []byte
- func (t *Transaction) IsSmartContract() bool
- func (t *Transaction) KeyID() int64
- func (t *Transaction) Payload() []byte
- func (t *Transaction) Play() error
- func (rtx *Transaction) SetRawTx() *sqldb.RawTx
- func (t *Transaction) SmartContract() *SmartTransactionParser
- func (t *Transaction) Timestamp() int64
- func (t *Transaction) Type() byte
- func (rtx *Transaction) Unmarshall(buffer *bytes.Buffer, fill bool) error
- func (tr *Transaction) WithOption(notifications types.Notifications, genBlock bool, ...) error
- type TransactionCaller
- type TransactionOption
- type TxOutCtx
Constants ¶
This section is empty.
Variables ¶
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")) )
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`) )
var (
ErrNetworkStopping = errors.New("network is stopping")
)
Functions ¶
func BannedTill ¶
BannedTill returns the time that the user has been banned till
func CheckLogTx ¶
CheckLogTx checks if this transaction exists And it would have successfully passed a frontal test
func CreateContract ¶
func CreateDelayTransactionHighRate ¶
func CreateDelayTransactionHighRate(data, hash []byte, keyID, highRate int64) *sqldb.Transaction
CreateDelayTransactionHighRate creates transaction
func CreateTransaction ¶
CreateTransaction creates transaction
func DeleteQueueTx ¶
func DeleteQueueTx(dbTx *sqldb.DbTransaction, hash []byte) error
DeleteQueueTx deletes a transaction from the queue
func IsKeyBanned ¶
IsKeyBanned returns true if the key has been banned
func MarkTransactionBad ¶
func NewInternalTransaction ¶
func NewInternalTransaction(smartTx types.SmartTransaction, privateKey []byte) (data, hash []byte, err error)
func NewTransactionInProc ¶
func NewTransactionInProc(smartTx types.SmartTransaction, privateKey []byte) (data, hash []byte, err error)
func ProcessQueueTransactionBatches ¶
func ProcessQueueTransactionBatches(dbTx *sqldb.DbTransaction, qs []*sqldb.QueueTx) error
func ProcessTransactionsAttempt ¶
func ProcessTransactionsAttempt(dbTx *sqldb.DbTransaction) error
AllTxParser parses new transactions
func ProcessTransactionsQueue ¶
func ProcessTransactionsQueue(dbTx *sqldb.DbTransaction) error
ProcessTransactionsQueue parses new transactions
Types ¶
type DeliverProvider ¶
type DeliverProvider interface { SysUpdateWorker(*sqldb.DbTransaction) error SysTableColByteaWorker(*sqldb.DbTransaction) error FlushVM() }
type FirstBlockParser ¶
type FirstBlockParser struct { Logger *log.Entry DbTransaction *sqldb.DbTransaction Data *types.FirstBlock Timestamp int64 TxHash []byte Payload []byte // transaction binary data }
FirstBlockParser is parser wrapper
func (*FirstBlockParser) Action ¶
func (f *FirstBlockParser) Action(in *InToCxt, out *OutCtx) (err error)
func (*FirstBlockParser) BinMarshal ¶
func (s *FirstBlockParser) BinMarshal(data *types.FirstBlock) ([]byte, error)
func (*FirstBlockParser) FlushVM ¶
func (f *FirstBlockParser) FlushVM()
func (*FirstBlockParser) Init ¶
func (f *FirstBlockParser) Init(in *InToCxt) error
func (*FirstBlockParser) SysTableColByteaWorker ¶
func (f *FirstBlockParser) SysTableColByteaWorker(dbTx *sqldb.DbTransaction) error
func (*FirstBlockParser) SysUpdateWorker ¶
func (f *FirstBlockParser) SysUpdateWorker(dbTx *sqldb.DbTransaction) error
func (*FirstBlockParser) TxRollback ¶
func (f *FirstBlockParser) TxRollback() error
func (*FirstBlockParser) Unmarshal ¶
func (f *FirstBlockParser) Unmarshal(buffer *bytes.Buffer) error
func (*FirstBlockParser) Validate ¶
func (f *FirstBlockParser) Validate() error
type InToCxt ¶
type InToCxt struct { SqlDbSavePoint string GenBlock bool DbTransaction *sqldb.DbTransaction BlockHeader *types.BlockHeader PreBlockHeader *types.BlockHeader Notifications types.Notifications Rand *rand.Rand TxCheckLimits *Limits OutputsMap map[sqldb.KeyUTXO][]sqldb.SpentInfo PrevSysPar map[string]string EcoParams []sqldb.EcoParam }
type LimitMode ¶
type LimitMode int
func GetLetGenBlock ¶
func GetLetGenBlock() LimitMode
func GetLetParsing ¶
func GetLetParsing() LimitMode
func GetLetPreprocess ¶
func GetLetPreprocess() LimitMode
type Limiter ¶
type Limiter interface {
// contains filtered or unexported methods
}
Limiter describes interface functions for limits
type Limits ¶
Limits is used for saving current limit information
func (*Limits) CheckLimit ¶
func (limits *Limits) CheckLimit(t TransactionCaller) error
CheckLimit calls each limiter
type OutCtx ¶
type OutCtx struct { SysUpdate bool RollBackTx []*types.RollbackTx TxResult *pbgo.TxResult TxOutputsMap map[sqldb.KeyUTXO][]sqldb.SpentInfo TxInputsMap map[sqldb.KeyUTXO][]sqldb.SpentInfo }
func (*OutCtx) Apply ¶
func (tr *OutCtx) Apply(opts ...OutCtxOption)
type OutCtxOption ¶
type OutCtxOption func(b *OutCtx)
func WithOutCtxRollBackTx ¶
func WithOutCtxRollBackTx(ret []*types.RollbackTx) OutCtxOption
func WithOutCtxSysUpdate ¶
func WithOutCtxSysUpdate(ret bool) OutCtxOption
func WithOutCtxTxInputs ¶
func WithOutCtxTxInputs(txInputsMap map[sqldb.KeyUTXO][]sqldb.SpentInfo) OutCtxOption
func WithOutCtxTxOutputs ¶
func WithOutCtxTxOutputs(txOutputsMap map[sqldb.KeyUTXO][]sqldb.SpentInfo) OutCtxOption
func WithOutCtxTxResult ¶
func WithOutCtxTxResult(ret *pbgo.TxResult) OutCtxOption
type SmartTransactionParser ¶
type SmartTransactionParser struct {
*smart.SmartContract
}
func (*SmartTransactionParser) Action ¶
func (s *SmartTransactionParser) Action(in *InToCxt, out *OutCtx) (err error)
func (*SmartTransactionParser) BinMarshalWithPrivate ¶
func (s *SmartTransactionParser) BinMarshalWithPrivate(smartTx *types.SmartTransaction, privateKey []byte, internal bool) ([]byte, error)
func (*SmartTransactionParser) FlushVM ¶
func (s *SmartTransactionParser) FlushVM()
func (*SmartTransactionParser) Init ¶
func (s *SmartTransactionParser) Init(t *InToCxt) error
func (*SmartTransactionParser) Marshal ¶
func (s *SmartTransactionParser) Marshal() ([]byte, error)
func (*SmartTransactionParser) SysTableColByteaWorker ¶
func (s *SmartTransactionParser) SysTableColByteaWorker(dbTx *sqldb.DbTransaction) error
func (*SmartTransactionParser) SysUpdateWorker ¶
func (s *SmartTransactionParser) SysUpdateWorker(dbTx *sqldb.DbTransaction) error
func (*SmartTransactionParser) TxRollback ¶
func (s *SmartTransactionParser) TxRollback() error
func (*SmartTransactionParser) Unmarshal ¶
func (s *SmartTransactionParser) Unmarshal(buffer *bytes.Buffer, fill bool) error
func (*SmartTransactionParser) Validate ¶
func (s *SmartTransactionParser) Validate() error
type StopNetworkParser ¶
type StopNetworkParser struct { Logger *log.Entry Data *types.StopNetwork Cert *x509.Cert Timestamp int64 TxHash []byte Payload []byte // transaction binary data }
func (*StopNetworkParser) Action ¶
func (s *StopNetworkParser) Action(in *InToCxt, out *OutCtx) (err error)
func (*StopNetworkParser) BinMarshal ¶
func (s *StopNetworkParser) BinMarshal(data *types.StopNetwork) ([]byte, error)
func (*StopNetworkParser) FlushVM ¶
func (s *StopNetworkParser) FlushVM()
func (*StopNetworkParser) Init ¶
func (s *StopNetworkParser) Init(in *InToCxt) error
func (*StopNetworkParser) SysTableColByteaWorker ¶
func (s *StopNetworkParser) SysTableColByteaWorker(dbTx *sqldb.DbTransaction) error
func (*StopNetworkParser) SysUpdateWorker ¶
func (s *StopNetworkParser) SysUpdateWorker(dbTx *sqldb.DbTransaction) error
func (*StopNetworkParser) TxRollback ¶
func (s *StopNetworkParser) TxRollback() error
func (*StopNetworkParser) Unmarshal ¶
func (s *StopNetworkParser) Unmarshal(buffer *bytes.Buffer) error
func (*StopNetworkParser) Validate ¶
func (s *StopNetworkParser) Validate() error
type Transaction ¶
type Transaction struct { FullData []byte // full transaction, with type and data *InToCxt *OutCtx Inner TransactionCaller }
Transaction is a structure for parsing transactions
func UnmarshallTransaction ¶
func UnmarshallTransaction(buffer *bytes.Buffer, fill bool) (*Transaction, error)
UnmarshallTransaction is unmarshalling transaction
func (*Transaction) Apply ¶
func (tr *Transaction) Apply(opts ...TransactionOption) error
func (*Transaction) Check ¶
func (t *Transaction) Check(checkTime int64) error
func (*Transaction) Expedite ¶
func (t *Transaction) Expedite() decimal.Decimal
func (*Transaction) GetLogger ¶
func (t *Transaction) GetLogger() *log.Entry
GetLogger returns logger
func (*Transaction) Hash ¶
func (t *Transaction) Hash() []byte
func (*Transaction) IsSmartContract ¶
func (t *Transaction) IsSmartContract() bool
func (*Transaction) KeyID ¶
func (t *Transaction) KeyID() int64
func (*Transaction) Payload ¶
func (t *Transaction) Payload() []byte
func (*Transaction) Play ¶
func (t *Transaction) Play() error
func (*Transaction) SetRawTx ¶
func (rtx *Transaction) SetRawTx() *sqldb.RawTx
func (*Transaction) SmartContract ¶
func (t *Transaction) SmartContract() *SmartTransactionParser
func (*Transaction) Timestamp ¶
func (t *Transaction) Timestamp() int64
func (*Transaction) Type ¶
func (t *Transaction) Type() byte
func (*Transaction) Unmarshall ¶
func (rtx *Transaction) Unmarshall(buffer *bytes.Buffer, fill bool) error
func (*Transaction) WithOption ¶
func (tr *Transaction) WithOption( notifications types.Notifications, genBlock bool, blockHeader, preBlockHeader *types.BlockHeader, dbTransaction *sqldb.DbTransaction, rand *rand.Rand, txCheckLimits *Limits, sqlDbSavePoint string, outputsMap map[sqldb.KeyUTXO][]sqldb.SpentInfo, prevSysPar map[string]string, ecoParams []sqldb.EcoParam, opts ...TransactionOption) error
type TransactionCaller ¶
type TransactionCaller interface { Init(*InToCxt) error Validate() error Action(*InToCxt, *OutCtx) error TxRollback() error // contains filtered or unexported methods }
TransactionCaller is parsing transactions
type TransactionOption ¶
type TransactionOption func(b *Transaction) error