Documentation ¶
Index ¶
- Variables
- func CalcCreateQuota(fee *big.Int) uint64
- func CalcPoWDifficulty(quotaRequired uint64) *big.Int
- func CalcQuota(db quotaDb, addr types.Address, pledgeAmount *big.Int, difficulty *big.Int) (quotaTotal uint64, quotaAddition uint64, err error)
- func CalcQuotaV2(db quotaDb, addr types.Address, pledgeAmount *big.Int, difficulty *big.Int) (uint64, uint64, error)
- func CanPoW(db quotaDb, addr types.Address) bool
- func CheckPoWLimit(db quotaDb) (bool, error)
- func GetPledgeQuota(db quotaDb, beneficial types.Address, pledgeAmount *big.Int) (uint64, error)
- func InitQuotaConfig(isTestParam bool)
- func IsPoW(nonce []byte) bool
- type NodeConfig
- type QuotaParams
Constants ¶
This section is empty.
Variables ¶
var ( QuotaParamTest = NewQuotaParams("4.200604096e-21", "6.40975486e-07") QuotaParamMainNet = NewQuotaParams("4.200627522e-24", "6.259419649e-10") )
Functions ¶
func CalcCreateQuota ¶
func CalcPoWDifficulty ¶ added in v1.3.0
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 CheckPoWLimit ¶ added in v1.3.0
A single account is limited to send 10 tx with PoW in one day
func GetPledgeQuota ¶
func InitQuotaConfig ¶
func InitQuotaConfig(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