quota

package
v2.10.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: GPL-3.0 Imports: 6 Imported by: 19

Documentation

Index

Constants

View Source
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 CalcQc

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

CalcQc calculate quota congestion ratio

func CalcStakeAmountByQuota

func CalcStakeAmountByQuota(q uint64) (*big.Int, error)

CalcStakeAmountByQuota calculate stake amount by expected quota used per second

func CanPoW added in v1.3.0

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

CanPoW checks whether an account address can calculate pow in current snapshot block

func CheckQuota

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

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.

Jump to

Keyboard shortcuts

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