txrules

package
v0.0.0-...-3680526 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package txrules provides transaction rules that should be followed by transaction authors for wide mempool acceptance and quick mining.

Index

Constants

View Source
const (
	// SatoshiPerBitcoin is the number of satoshi in one bitcoin (1 BTC).
	SatoshiPerBitcoin = 1e8

	// MaxSatoshi is the maximum transaction amount allowed in satoshi.
	MaxSatoshi = 21e6 * SatoshiPerBitcoin
)
View Source
const DefaultRelayFeePerKb = mempool.DefaultMinRelayTxFee

DefaultRelayFeePerKb is the default minimum relay fee policy for a mempool.

Variables

View Source
var (
	ErrAmountNegative   = errors.New("transaction output amount is negative")
	ErrAmountExceedsMax = errors.New("transaction output amount exceeds maximum value")
	ErrOutputIsDust     = errors.New("transaction output is dust")
)

Transaction rule violations

Functions

func CheckOutput

func CheckOutput(output *types.TxOutput, relayFeePerKb int64) error

CheckOutput performs simple consensus and policy tests on a transaction output.

func FeeForSerializeSize

func FeeForSerializeSize(relayFeePerKb types.Amount, txSerializeSize int) types.Amount

FeeForSerializeSize calculates the required fee for a transaction of some arbitrary size given a mempool's relay fee policy.

func GetDustThreshold

func GetDustThreshold(scriptSize int, relayFeePerKb int64) int64

GetDustThreshold is used to define the amount below which output will be determined as dust. Threshold is determined as 3 times the relay fee.

func IsDustAmount

func IsDustAmount(amount types.Amount, scriptSize int, relayFeePerKb int64) bool

IsDustAmount determines whether a transaction output value and script length would cause the output to be considered dust. Transactions with dust outputs are not standard and are rejected by mempools with default policies.

func IsDustOutput

func IsDustOutput(output *types.TxOutput, relayFeePerKb int64) bool

IsDustOutput determines whether a transaction output is considered dust. Transactions with dust outputs are not standard and are rejected by mempools with default policies.

Types

This section is empty.

Jump to

Keyboard shortcuts

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