lp226

package
v1.22.21 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

LP-226 implements the dynamic minimum block delay mechanism specified here: https://github.com/luxfi/lps/blob/main/LPs/226-dynamic-minimum-block-times/README.md

Index

Constants

View Source
const (
	// MinDelayMilliseconds (M) is the minimum block delay in milliseconds
	MinDelayMilliseconds = 1 // ms
	// ConversionRate (D) is the conversion factor for exponential calculations
	ConversionRate = 1 << 20
	// MaxDelayExcessDiff (Q) is the maximum change in excess per update
	MaxDelayExcessDiff = 200

	// InitialDelayExcess represents the initial (≈2000ms) delay excess.
	// Formula: ConversionRate (2^20) * ln(2000) + 1
	InitialDelayExcess = 7_970_124
)

Variables

This section is empty.

Functions

func DesiredDelayExcess

func DesiredDelayExcess(desiredDelay uint64) uint64

DesiredDelayExcess calculates the optimal delay excess given the desired delay.

Types

type DelayExcess

type DelayExcess uint64

DelayExcess represents the excess for delay calculation in the dynamic minimum block delay mechanism.

func (DelayExcess) Delay

func (t DelayExcess) Delay() uint64

Delay returns the minimum block delay in milliseconds, `m`.

Delay = MinDelayMilliseconds * e^(DelayExcess / ConversionRate)

func (*DelayExcess) UpdateDelayExcess

func (t *DelayExcess) UpdateDelayExcess(desiredDelayExcess uint64)

UpdateDelayExcess updates the DelayExcess to be as close as possible to the desiredDelayExcess without exceeding the maximum DelayExcess change.

Directories

Path Synopsis
LP-226 implements the dynamic minimum block delay mechanism specified here: https://github.com/luxfi/LPs/blob/main/LPs/226-dynamic-minimum-block-times/README.md
LP-226 implements the dynamic minimum block delay mechanism specified here: https://github.com/luxfi/LPs/blob/main/LPs/226-dynamic-minimum-block-times/README.md

Jump to

Keyboard shortcuts

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