globalcfg

package
v0.0.0-...-61a3908 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 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 btcd.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMaxTimeOffsetSeconds

func GetMaxTimeOffsetSeconds() time.Duration

GetMaxTimeOffsetSeconds 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 MaxSatoshi

func MaxSatoshi() int64

MaxSatoshi returns the maximum number of atomic units of currency

func NewAmount

func NewAmount(f float64) (int64, error)

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/btcsuite/btcutil#example-Amount

func RemoveConfig

func RemoveConfig() bool

RemoveConfig deletes the config, used in tests

func SatoshiPerBitcoin

func SatoshiPerBitcoin() int64

SatoshiPerBitcoin returns the number of atomic units per "coin"

func SelectConfig

func SelectConfig(conf Config) bool

SelectConfig is used to register the blockchain parameters with globalcfg

Types

type Config

type Config struct {
	ProofOfWorkAlgorithm ProofOfWork
	HasNetworkSteward    bool
	MaxSatoshi           int64
	SatoshiPerBitcoin    int64
	MaxTimeOffsetSeconds time.Duration
	MedianTimeBlocks     int
}

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

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 Mantle proof of work
	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