utils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDecodedTxs

func GetDecodedTxs(txDecoder sdk.TxDecoder, txs [][]byte) ([]sdk.Tx, error)

GetDecodedTxs returns the decoded transactions from the given bytes.

func GetMaxTxBytesForLane

func GetMaxTxBytesForLane(maxTxBytes, totalTxBytes int64, ratio sdk.Dec) int64

GetMaxTxBytesForLane returns the maximum number of bytes that can be included in the proposal for the given lane.

func GetTxHashStr

func GetTxHashStr(txEncoder sdk.TxEncoder, tx sdk.Tx) ([]byte, string, error)

GetTxHashStr returns the hex-encoded hash of the transaction alongside the transaction bytes.

func RemoveTxsFromLane

func RemoveTxsFromLane(txs map[sdk.Tx]struct{}, mempool sdkmempool.Mempool) error

RemoveTxsFromLane removes the transactions from the given lane's mempool.

Types

type IgnoreDecorator

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

IgnoreDecorator is an AnteDecorator that wraps an existing AnteDecorator. It allows for the AnteDecorator to be ignored for specified lanes.

func NewIgnoreDecorator

func NewIgnoreDecorator(decorator sdk.AnteDecorator, lanes ...Lane) *IgnoreDecorator

NewIgnoreDecorator returns a new IgnoreDecorator instance.

func (IgnoreDecorator) AnteHandle

func (sd IgnoreDecorator) AnteHandle(
	ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler,
) (sdk.Context, error)

AnteHandle implements the sdk.AnteDecorator interface. If the transaction belongs to one of the lanes, the next AnteHandler is called. Otherwise, the decorator's AnteHandler is called.

type Lane

type Lane interface {
	Match(tx sdk.Tx) bool
}

Lane defines the required functionality for a lane. The ignore decorator will check if a transaction belongs to a lane by calling the Match function.

Jump to

Keyboard shortcuts

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