txfilter

package
v1.2.1-patch3 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

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 DoFilter

func DoFilter(from, to common.Address, balance *big.Int, txDataBytes []byte, height int64) (isBetTx bool, err error)

func IsBetTx

func IsBetTx(to common.Address) bool

func IsBlocked

func IsBlocked(from, to common.Address, balance *big.Int, txDataBytes []byte) (err error)

func IsLockTx

func IsLockTx(to common.Address) bool

func IsUnlockTx

func IsUnlockTx(to common.Address) bool

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

func NewPosItem(height int64, slots int64, pubKey abciTypes.PubKey, tmAddress string, blsKeyString string, beneficiary common.Address) *PosItem

func (*PosItem) Copy

func (pi *PosItem) Copy() *PosItem

type PosItemSortedQueue

type PosItemSortedQueue []*PosItemWithSigner

func NewPosItemSortedQueue

func NewPosItemSortedQueue() *PosItemSortedQueue

func (*PosItemSortedQueue) Copy

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

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 *PosTable) CanRemovePosItem() error

func (*PosTable) Copy

func (posTable *PosTable) Copy() *PosTable

func (*PosTable) ExportSortedSigners

func (posTable *PosTable) ExportSortedSigners()

func (*PosTable) InitStruct

func (posTable *PosTable) InitStruct()

func (*PosTable) RemovePosItem

func (posTable *PosTable) RemovePosItem(signer common.Address, height int64, slash bool) error

func (*PosTable) SelectItemByHeightValue

func (posTable *PosTable) SelectItemByHeightValue(random int64) (common.Address, PosItem)

func (*PosTable) SelectItemBySeedValue

func (posTable *PosTable) SelectItemBySeedValue(vrf []byte, len int) (common.Address, PosItem)

func (*PosTable) SetThreshold

func (posTable *PosTable) SetThreshold(threshold *big.Int)

func (*PosTable) String

func (posTable *PosTable) String() string

func (*PosTable) TopKSigners

func (posTable *PosTable) TopKSigners(k int) []common.Address

func (*PosTable) TryRemoveUnbondPosItems

func (posTable *PosTable) TryRemoveUnbondPosItems(currentHeight int64, sortedUnbondSigners []common.Address) int

func (*PosTable) UpsertPosItem

func (posTable *PosTable) UpsertPosItem(signer common.Address, pi *PosItem) error

type TxData

type TxData struct {
	PubKey       abciTypes.PubKey `json:"pub_key"`
	Beneficiary  string           `json:"beneficiary"`
	BlsKeyString string           `json:"bls_key_string"`
}

func UnMarshalTxData

func UnMarshalTxData(jsonByte []byte) (*TxData, error)

type UnbondPosItemSortedQueue

type UnbondPosItemSortedQueue []*PosItemWithSigner

func NewUnbondPosItemSortedQueue

func NewUnbondPosItemSortedQueue() *UnbondPosItemSortedQueue

func (*UnbondPosItemSortedQueue) Copy

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)

Jump to

Keyboard shortcuts

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