fee

package
v0.0.0-...-d29d52d Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BurnFactor inverse fraction of coinhours that must be burned
	BurnFactor uint64 = 2
)

Variables

View Source
var (
	// ErrTxnNoFee is returned if a transaction has no coinhour fee
	ErrTxnNoFee = errors.New("Transaction has zero coinhour fee")

	// ErrTxnInsufficientFee is returned if a transaction's coinhour burn fee is not enough
	ErrTxnInsufficientFee = errors.New("Transaction coinhour fee minimum not met")

	// ErrTxnInsufficientCoinHours is returned if a transaction has more coinhours in its outputs than its inputs
	ErrTxnInsufficientCoinHours = errors.New("Insufficient coinhours for transaction outputs")
)

Functions

func RemainingHours

func RemainingHours(hours uint64) uint64

RemainingHours returns the amount of coinhours leftover after paying the fee for the input.

func RequiredFee

func RequiredFee(hours uint64) uint64

RequiredFee returns the coinhours fee required for an amount of hours The required fee is calculated as hours/BurnFactor, rounded up.

func TransactionFee

func TransactionFee(tx *coin.Transaction, headTime uint64, inUxs coin.UxArray) (uint64, error)

TransactionFee calculates the current transaction fee in coinhours of a Transaction. Returns ErrTxnInsufficientCoinHours if input hours is less than output hours.

func VerifyTransactionFee

func VerifyTransactionFee(t *coin.Transaction, fee uint64) error

VerifyTransactionFee performs additional transaction verification at the unconfirmed pool level. This checks tunable parameters that should prevent the transaction from entering the blockchain, but cannot be done at the blockchain level because they may be changed.

func VerifyTransactionFeeForHours

func VerifyTransactionFeeForHours(hours, fee uint64) error

VerifyTransactionFeeForHours verifies the fee given fee and hours, where hours is the number of hours in a transaction's outputs, and hours+fee is the number of hours in a transaction's inputs

Types

This section is empty.

Jump to

Keyboard shortcuts

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