finance

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTxsOutOfRange = errors.New("current txs is out of range")

	ErrGasOutOfRange = errors.New("parent gas price is out of range")
)

Functions

This section is empty.

Types

type Gas

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

func NewGas

func NewGas(repo *repo.Repo) *Gas

func (*Gas) CalNextGasPrice

func (gas *Gas) CalNextGasPrice(parentGasPrice uint64, txs int) (uint64, error)

CalNextGasPrice returns the current block gas price, based on the formula:

G_c = G_p * (1 + (0.5 * (MaxBatchSize - TxsCount) / MaxBatchSize))

if G_c <= minGasPrice, G_c = minGasPrice

if G_c >= maxGasPrice, G_c = maxGasPrice

Jump to

Keyboard shortcuts

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