Documentation ¶
Index ¶
- Constants
- func CalcBlockQuotaUsed(db quotaDb, block *ledger.AccountBlock, sbHeight uint64) (uint64, error)
- func CalcPoWDifficulty(db quotaDb, quotaRequired uint64, q types.Quota, sbHeight uint64) (*big.Int, error)
- func CalcQc(db quotaDb, sbHeight uint64) (*big.Int, uint64, bool)
- func CalcStakeAmountByQuota(q uint64) (*big.Int, error)
- func CanPoW(db quotaDb, address types.Address) bool
- func CheckQuota(db quotaDb, q types.Quota, addr types.Address) (bool, uint64)
- func GetQuota(db quotaDb, beneficial types.Address, stakeAmount *big.Int, sbHeight uint64) (types.Quota, error)
- func GetQuotaForBlock(db quotaDb, addr types.Address, stakeAmount *big.Int, difficulty *big.Int, ...) (quotaTotal, quotaAddition uint64, err error)
- func GetSnapshotCurrentQuota(db quotaDb, beneficial types.Address, stakeAmount *big.Int, sbHeight uint64) (uint64, error)
- func InitQuotaConfig(isTest, isTestParam bool)
Constants ¶
const ( // QuotaForCreateContractResponse defines available quota for create contract response block QuotaForCreateContractResponse uint64 = 1000000 // QuotaPerUt defines quota amount of 1 unit transaction QuotaPerUt uint64 = 21000 )
Variables ¶
This section is empty.
Functions ¶
func CalcBlockQuotaUsed ¶
func CalcBlockQuotaUsed(db quotaDb, block *ledger.AccountBlock, sbHeight uint64) (uint64, error)
CalcBlockQuotaUsed recalculate quotaUsed field of an account block
func CalcPoWDifficulty ¶ added in v1.3.0
func CalcPoWDifficulty(db quotaDb, quotaRequired uint64, q types.Quota, sbHeight uint64) (*big.Int, error)
CalcPoWDifficulty calculate pow difficulty by quota
func CalcStakeAmountByQuota ¶
CalcStakeAmountByQuota calculate stake amount by expected quota used per second
func CanPoW ¶ added in v1.3.0
CanPoW checks whether an account address can calculate pow in current snapshot block
func CheckQuota ¶
CheckQuota check whether current quota of a contract account is enough to receive a new block
func GetQuota ¶
func GetQuota(db quotaDb, beneficial types.Address, stakeAmount *big.Int, sbHeight uint64) (types.Quota, error)
GetQuota calculate available quota for an account
func GetQuotaForBlock ¶
func GetQuotaForBlock(db quotaDb, addr types.Address, stakeAmount *big.Int, difficulty *big.Int, sbHeight uint64) (quotaTotal, quotaAddition uint64, err error)
GetQuotaForBlock calculate available quota for a block
func GetSnapshotCurrentQuota ¶
func GetSnapshotCurrentQuota(db quotaDb, beneficial types.Address, stakeAmount *big.Int, sbHeight uint64) (uint64, error)
GetSnapshotCurrentQuota calculate available quota for an account, excluding unconfirmed blocks
func InitQuotaConfig ¶
func InitQuotaConfig(isTest, isTestParam bool)
InitQuotaConfig init global status of quota calculation. This method is supposed be called when the node started.
Types ¶
This section is empty.