Documentation ¶
Index ¶
- Constants
- func DoFilter(from, to common.Address, balance *big.Int, txDataBytes []byte, height int64) (isBetTx bool, err error)
- func IsBetTx(to common.Address) bool
- func IsBlocked(from, to common.Address, balance *big.Int, txDataBytes []byte) (err error)
- func IsLockTx(to common.Address) bool
- func IsUnlockTx(to common.Address) bool
- type PosItem
- type PosItemSortedQueue
- type PosItemWithSigner
- type PosTable
- func (posTable *PosTable) CanRemovePosItem() error
- func (posTable *PosTable) Copy() *PosTable
- func (posTable *PosTable) ExportSortedSigners()
- func (posTable *PosTable) InitStruct()
- func (posTable *PosTable) RemovePosItem(signer common.Address, height int64, slash bool) error
- func (posTable *PosTable) SelectItemByHeightValue(random int64) (common.Address, PosItem)
- func (posTable *PosTable) SelectItemBySeedValue(vrf []byte, len int) (common.Address, PosItem)
- func (posTable *PosTable) SetThreshold(threshold *big.Int)
- func (posTable *PosTable) String() string
- func (posTable *PosTable) TopKSigners(k int) []common.Address
- func (posTable *PosTable) TryRemoveUnbondPosItems(currentHeight int64, sortedUnbondSigners []common.Address) int
- func (posTable *PosTable) UpsertPosItem(signer common.Address, pi *PosItem) error
- type TxData
- type UnbondPosItemSortedQueue
- func (pq *UnbondPosItemSortedQueue) Copy() *UnbondPosItemSortedQueue
- func (pq *UnbondPosItemSortedQueue) Len() int
- func (pq *UnbondPosItemSortedQueue) Less(i, j int) bool
- func (pq *UnbondPosItemSortedQueue) Pop() interface{}
- func (pq *UnbondPosItemSortedQueue) Push(x interface{})
- func (pq *UnbondPosItemSortedQueue) Swap(i, j int)
Constants ¶
View Source
const EpochBlocks = int64(200)
View Source
const ThresholdUnit = 1000
it means the lowest bond balance must equal or larger than the 1/1000 of totalBalance
View Source
const UnbondWaitEpochs = 3
Variables ¶
This section is empty.
Functions ¶
func IsUnlockTx ¶
Types ¶
type PosItem ¶
type PosItem struct { Height int64 `json:"height"` Slots int64 `json:"slots"` PubKey abciTypes.PubKey `json:"pubKey"` TmAddress string `json:"tm_address"` BlsKeyString string `json:"bls_key_string"` Beneficiary common.Address `json:"beneficiary"` BeneficiaryBonus *big.Int `json:"beneficiary_bonus"` //currently not used }
func NewPosItem ¶
type PosItemSortedQueue ¶
type PosItemSortedQueue []*PosItemWithSigner
func NewPosItemSortedQueue ¶
func NewPosItemSortedQueue() *PosItemSortedQueue
func (*PosItemSortedQueue) Copy ¶
func (pq *PosItemSortedQueue) Copy() *PosItemSortedQueue
func (*PosItemSortedQueue) Len ¶
func (pq *PosItemSortedQueue) Len() int
func (*PosItemSortedQueue) Less ¶
func (pq *PosItemSortedQueue) Less(i, j int) bool
func (*PosItemSortedQueue) Pop ¶
func (pq *PosItemSortedQueue) Pop() interface{}
func (*PosItemSortedQueue) Push ¶
func (pq *PosItemSortedQueue) Push(x interface{})
func (*PosItemSortedQueue) Swap ¶
func (pq *PosItemSortedQueue) Swap(i, j int)
type PosItemWithSigner ¶
type PosItemWithSigner struct { Height int64 Signer common.Address Slots int64 // contains filtered or unexported fields }
=============================================================================
func (*PosItemWithSigner) Copy ¶
func (pi *PosItemWithSigner) Copy() *PosItemWithSigner
type PosTable ¶
type PosTable struct { Mtx sync.RWMutex `json:"-"` InitFlag bool `json:"-"` PosItemMap map[common.Address]*PosItem `json:"pos_item_map"` SortedPosItems *PosItemSortedQueue `json:"-"` PosItemIndexMap map[common.Address]*PosItemWithSigner `json:"-"` TotalSlots int64 `json:"-"` SortedSigners []common.Address `json:"-"` UnbondPosItemMap map[common.Address]*PosItem `json:"unbond_pos_item_map"` SortedUnbondPosItems *UnbondPosItemSortedQueue `json:"-"` UnbondPosItemIndexMap map[common.Address]*PosItemWithSigner `json:"-"` SortedUnbondSigners []common.Address `json:"-"` TmAddressToSignerMap map[string]common.Address `json:"-"` BlsKeyStringToSignerMap map[string]common.Address `json:"-"` Threshold *big.Int `json:"threshold"` // threshold value of PosTable ChangedFlagThisBlock bool `json:"-"` }
var (
EthPosTable *PosTable
)
func CreatePosTable ¶
func CreatePosTable() *PosTable
func NewPosTable ¶
func NewPosTable() *PosTable
func (*PosTable) CanRemovePosItem ¶
func (*PosTable) ExportSortedSigners ¶
func (posTable *PosTable) ExportSortedSigners()
func (*PosTable) InitStruct ¶
func (posTable *PosTable) InitStruct()
func (*PosTable) RemovePosItem ¶
func (*PosTable) SelectItemByHeightValue ¶
func (*PosTable) SelectItemBySeedValue ¶
func (*PosTable) SetThreshold ¶
func (*PosTable) TryRemoveUnbondPosItems ¶
type TxData ¶
type TxData struct { PubKey abciTypes.PubKey `json:"pub_key"` Beneficiary string `json:"beneficiary"` BlsKeyString string `json:"bls_key_string"` }
func UnMarshalTxData ¶
type UnbondPosItemSortedQueue ¶
type UnbondPosItemSortedQueue []*PosItemWithSigner
func NewUnbondPosItemSortedQueue ¶
func NewUnbondPosItemSortedQueue() *UnbondPosItemSortedQueue
func (*UnbondPosItemSortedQueue) Copy ¶
func (pq *UnbondPosItemSortedQueue) Copy() *UnbondPosItemSortedQueue
func (*UnbondPosItemSortedQueue) Len ¶
func (pq *UnbondPosItemSortedQueue) Len() int
func (*UnbondPosItemSortedQueue) Less ¶
func (pq *UnbondPosItemSortedQueue) Less(i, j int) bool
func (*UnbondPosItemSortedQueue) Pop ¶
func (pq *UnbondPosItemSortedQueue) Pop() interface{}
func (*UnbondPosItemSortedQueue) Push ¶
func (pq *UnbondPosItemSortedQueue) Push(x interface{})
func (*UnbondPosItemSortedQueue) Swap ¶
func (pq *UnbondPosItemSortedQueue) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.