quota

package
v0.0.3-powserver Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: GPL-3.0 Imports: 7 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDifficulty = new(big.Int).SetUint64(0xffffffc000000000)

Functions

func CalcCreateQuota

func CalcCreateQuota(fee *big.Int) uint64

func CalcQuota

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

quotaInit = quotaLimitForAccount * (1 - 2/(1 + e**(fDifficulty * difficulty + fPledge * snapshotHeightGap * pledgeAmount)))

  • quota used by prevBlock referring to the same snapshot hash

quotaAddition = quotaLimitForAccount * (1 - 2/(1 + e**(fDifficulty * difficulty + fPledge * snapshotHeightGap * pledgeAmount)))

  • quotaLimitForAccount * (1 - 2/(1 + e**(fPledge * snapshotHeightGap * pledgeAmount)))

snapshotHeightGap is limit to 1 day e**(fDifficulty * difficulty + fPledge * snapshotHeightGap * pledgeAmount) is discrete to reduce computation complexity quotaLimitForAccount is within a range decided by net congestion and net capacity user account gets extra quota to send or receive a transaction if calc PoW, extra quota is decided by difficulty contract account only gets quota via pledge user account genesis block(a receive block) must calculate a PoW to get quota

func CalcQuotaV2

func CalcQuotaV2(db quotaDb, addr types.Address, pledgeAmount *big.Int, difficulty *big.Int) (uint64, uint64, error)

func GetPledgeQuota

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

func IsPoW

func IsPoW(nonce []byte) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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