mempool

package
v3.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBlockReward

func GetBlockReward(baseReward, medianWeight, fees, weight uint64) uint64

GetBlockReward Faster and limited version of block.GetBlockReward

Types

type Entry added in v3.4.0

type Entry struct {
	Id           types.Hash `json:"id"`
	BlobSize     uint64     `json:"blob_size"`
	Weight       uint64     `json:"weight"`
	Fee          uint64     `json:"fee"`
	TimeReceived time.Time  `json:"-"`
}

func (*Entry) Compare added in v3.4.0

func (t *Entry) Compare(o *Entry) int

Compare returns -1 if self is preferred over o, 0 if equal, 1 if o is preferred over self

type Mempool

type Mempool []*Entry

func (Mempool) Fees

func (m Mempool) Fees() (r uint64)

func (Mempool) PerfectSum

func (m Mempool) PerfectSum(targetFee uint64) chan Mempool

func (Mempool) Pick

func (m Mempool) Pick(baseReward, minerTxWeight, medianWeight uint64) Mempool

Pick Selects transactions semi-optimally

Picking all transactions will result in the base reward penalty Use a heuristic algorithm to pick transactions and get the maximum possible reward Testing has shown that this algorithm is very close to the optimal selection Usually no more than 0.5 micronero away from the optimal discrete knapsack solution Sometimes it even finds the optimal solution

func (Mempool) Sort

func (m Mempool) Sort()

func (Mempool) Weight

func (m Mempool) Weight() (r uint64)

func (Mempool) WeightAndFees

func (m Mempool) WeightAndFees() (weight, fees uint64)

Jump to

Keyboard shortcuts

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