Documentation ¶
Overview ¶
Package globalcfg contains configuration which must be available anywhere in the project, do not import anything which is part of pktd.
Index ¶
- Variables
- func GetMaxTimeOffset() time.Duration
- func GetMedianTimeBlocks() int
- func HasNetworkSteward() bool
- func IsPacketCryptAllowedVersion(version int, blockHeight int32) bool
- func MaxUnitsI64() int64
- func NewAmount(f float64) (int64, er.R)
- func SatoshiPerBitcoin() int64
- func SelectConfig(conf Config)
- func UnitsPerCoinI64() int64
- type CoinAmount
- type Config
- type ProofOfWork
Constants ¶
This section is empty.
Variables ¶
var IgnoreMined bool
Functions ¶
func GetMaxTimeOffset ¶
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 ¶
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 ¶
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 ¶
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.