sfctype

package
v0.0.0-...-59e56fa Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ForkBit is set if staker has a confirmed pair of fork events
	ForkBit = uint64(1)
	// OfflineBit is set if staker has didn't have confirmed events for a long time
	OfflineBit = uint64(1 << 8)
	// CheaterMask is a combination of severe misbehavings
	CheaterMask = ForkBit
)

Functions

func EpochIsForceSealed

func EpochIsForceSealed(receipts types.Receipts) bool

EpochIsForceSealed

Types

type EpochStats

type EpochStats struct {
	Start    inter.Timestamp
	End      inter.Timestamp
	TotalFee *big.Int

	Epoch                 idx.Epoch `rlp:"-"` // API-only field
	TotalBaseRewardWeight *big.Int  `rlp:"-"` // API-only field
	TotalTxRewardWeight   *big.Int  `rlp:"-"` // API-only field
}

EpochStats stores general statistics for an epoch

func (*EpochStats) Duration

func (s *EpochStats) Duration() inter.Timestamp

Duration returns epoch duration

type SfcDelegator

type SfcDelegator struct {
	CreatedEpoch idx.Epoch
	CreatedTime  inter.Timestamp

	DeactivatedEpoch idx.Epoch
	DeactivatedTime  inter.Timestamp

	Amount *big.Int

	ToStakerID idx.StakerID
}

SfcDelegator is the node-side representation of SFC delegator

type SfcDelegatorAndAddr

type SfcDelegatorAndAddr struct {
	Delegator *SfcDelegator
	Addr      common.Address
}

SfcDelegatorAndAddr is pair SfcDelegator + address

type SfcStaker

type SfcStaker struct {
	CreatedEpoch idx.Epoch
	CreatedTime  inter.Timestamp

	DeactivatedEpoch idx.Epoch
	DeactivatedTime  inter.Timestamp

	StakeAmount *big.Int
	DelegatedMe *big.Int

	Address common.Address

	Status uint64

	IsValidator bool `rlp:"-"` // API-only field
}

SfcStaker is the node-side representation of SFC staker

func (*SfcStaker) CalcTotalStake

func (s *SfcStaker) CalcTotalStake() *big.Int

CalcTotalStake returns sum of staker's stake and delegated to staker stake

func (*SfcStaker) HasFork

func (s *SfcStaker) HasFork() bool

HasFork returns true if staker has a confirmed fork

func (*SfcStaker) IsCheater

func (s *SfcStaker) IsCheater() bool

IsCheater returns true if staker is cheater

func (*SfcStaker) Offline

func (s *SfcStaker) Offline() bool

Offline returns true if staker was offline for long time

func (*SfcStaker) Ok

func (s *SfcStaker) Ok() bool

Ok returns true if not deactivated and not pruned

type SfcStakerAndID

type SfcStakerAndID struct {
	StakerID idx.StakerID
	Staker   *SfcStaker
}

SfcStakerAndID is pair SfcStaker + StakerID

Jump to

Keyboard shortcuts

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