quota

package
v0.0.0-...-96daba7 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QuotaForUtps uint64 = 21000
)

Variables

View Source
var (
	QuotaParamMainnet = NewQuotaParams("4.201037667e-24", "6.259408129e-10")
	QuotaParamTestnet = NewQuotaParams("4.200617563e-21", "6.409829346e-07")
)

Functions

func CalcBlockQuota

func CalcBlockQuota(db quotaDb, block *ledger.AccountBlock, sbHeight uint64) (uint64, error)

func CalcCreateQuota

func CalcCreateQuota(fee *big.Int) uint64

func CalcPledgeAmountByUtps

func CalcPledgeAmountByUtps(utps float64) (*big.Int, error)

func CalcPoWDifficulty

func CalcPoWDifficulty(db quotaDb, quotaRequired uint64, q types.Quota, sbHeight uint64) (*big.Int, error)

func CalcQc

func CalcQc(db quotaDb, sbHeight uint64) (*big.Int, uint64, bool)

func CalcQuotaForBlock

func CalcQuotaForBlock(db quotaDb, addr types.Address, pledgeAmount *big.Int, difficulty *big.Int, sbHeight uint64) (quotaTotal, quotaAddition uint64, err error)

func CalcSnapshotCurrentQuota

func CalcSnapshotCurrentQuota(db quotaDb, beneficial types.Address, pledgeAmount *big.Int, sbHeight uint64) (uint64, error)

func CanPoW

func CanPoW(db quotaDb, address types.Address) bool

func CheckQuota

func CheckQuota(db quotaDb, q types.Quota, addr types.Address) bool

Check whether current quota of a contract account is enough to receive a new block

func GetPledgeQuota

func GetPledgeQuota(db quotaDb, beneficial types.Address, pledgeAmount *big.Int, sbHeight uint64) (types.Quota, error)

func InitQuotaConfig

func InitQuotaConfig(isTest, isTestParam bool)

Types

type NodeConfig

type NodeConfig struct {
	QuotaParams
	// contains filtered or unexported fields
}

type QuotaParams

type QuotaParams struct {
	// contains filtered or unexported fields
}

func NewQuotaParams

func NewQuotaParams(strA, strB string) QuotaParams

Jump to

Keyboard shortcuts

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