globalcfg

package
v0.0.0-...-0cf96f8 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: ISC Imports: 3 Imported by: 0

Documentation

Overview

Package globalcfg contains configuration which must be available anywhere in the project, do not import anything which is part of pktd.

Index

Constants

This section is empty.

Variables

View Source
var IgnoreMined bool

Functions

func GetMaxTimeOffset

func GetMaxTimeOffset() time.Duration

GetMaxTimeOffset is the maximum number of seconds a block time is allowed to be ahead of the current time.

func GetMedianTimeBlocks

func GetMedianTimeBlocks() int

GetMedianTimeBlocks provides the number of previous blocks which should be used to calculate the median time used to validate block timestamps.

func HasNetworkSteward

func HasNetworkSteward() bool

HasNetworkSteward returns true for blockchains which require a network steward fee

func IsPacketCryptAllowedVersion

func IsPacketCryptAllowedVersion(version int, blockHeight int32) bool

IsPacketCryptAllowedVersion tells whether the specified version of PacketCrypt proof is allowed.

func MaxUnitsI64

func MaxUnitsI64() int64

MaxUnitsU64 returns the maximum number of atomic units of currency

func NewAmount

func NewAmount(f float64) (int64, er.R)

NewAmount creates an Amount from a floating point value representing some value in bitcoin. NewAmount errors if f is NaN or +-Infinity, but does not check that the amount is within the total amount of bitcoin producible as f may not refer to an amount at a single moment in time.

NewAmount is for specifically for converting BTC to Satoshi. For creating a new Amount with an int64 value which denotes a quantity of Satoshi, do a simple type conversion from type int64 to Amount. See GoDoc for example: http://godoc.org/github.com/pkt-cash/btcutil#example-Amount

func SatoshiPerBitcoin

func SatoshiPerBitcoin() int64

SatoshiPerBitcoin returns the number of atomic units per "coin"

func SelectConfig

func SelectConfig(conf Config)

SelectConfig is used to register the blockchain parameters with globalcfg

func UnitsPerCoinI64

func UnitsPerCoinI64() int64

UnitsPerCoinI64 returns the maximum number of atomic units per "coin"

Types

type CoinAmount

type CoinAmount struct {
	Name       string
	ProperName string
	Units      int64
	Zeros      int
}

func AmountUnits

func AmountUnits() []CoinAmount

type Config

type Config struct {
	ProofOfWorkAlgorithm ProofOfWork
	HasNetworkSteward    bool
	MaxUnits             int64
	UnitsPerCoin         int64
	MaxTimeOffset        time.Duration
	MedianTimeBlocks     int
	Amounts              []CoinAmount
}

Config is the global config which is accessible anywhere in the app

func BitcoinDefaults

func BitcoinDefaults() Config

BitcoinDefaults creates a new config with the default values for bitcoin

func PktDefaults

func PktDefaults() Config

type ProofOfWork

type ProofOfWork int

ProofOfWork means the type of proof of work used on the chain

const (
	// PowSha256 is the original proof of work from satoshi.
	// This is the default value
	PowSha256 ProofOfWork = iota

	// PowPacketCrypt is the PoW used by chains such as pkt.cash
	PowPacketCrypt
)

func GetProofOfWorkAlgorithm

func GetProofOfWorkAlgorithm() ProofOfWork

GetProofOfWorkAlgorithm tells whether the chain in use uses a custom proof of work algorithm or the normal sha256 proof of work.

Jump to

Keyboard shortcuts

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