Documentation ¶
Overview ¶
Package types contains data types related to abeychain consensus.
Index ¶
- Constants
- Variables
- func BloomLookup(bin Bloom, topic bytesBacked) bool
- func CalcSignHash(signs []*PbftSign) common.Hash
- func CalcUncleHash(uncles []*Header) common.Hash
- func CopyVotePk(pk []byte) []byte
- func DeriveSha(list DerivableList) common.Hash
- func FetchOneToAbey(sas []*SARewardInfos, addr common.Address) map[string]interface{}
- func ForbidAddress(addr common.Address) error
- func FromBlock(block *SnailBlock) (begin, end uint64)
- func FruitNumber(b1, b2 *SnailBlock) bool
- func IsUnlocked(eid, height uint64) bool
- func LogsBloom(logs []*Log) *big.Int
- func MergeReward(map1, map2 map[common.Address]*big.Int) map[common.Address]*big.Int
- func MinCalcRedeemHeight(eid uint64) uint64
- func Number(b1, b2 *Block) bool
- func Payer(signer Signer, tx *Transaction) (common.Address, error)
- func RlpHash(x interface{}) (h common.Hash)
- func Sender(signer Signer, tx *Transaction) (common.Address, error)
- func SignatureValues(tx *Transaction, sig []byte) (r, s, v *big.Int, err error)
- func SnailNumber(b1, b2 *SnailBlock) bool
- func ToAbey(val *big.Int) *big.Float
- func ToJSON(ii *ImpawnSummay) map[string]interface{}
- func ValidPk(pk []byte) error
- type BalanceChangeContent
- type BalanceInfo
- type Block
- func (b *Block) AllSigns() []*PbftSign
- func (b *Block) AppendSign(sign *PbftSign)
- func (b *Block) AppendSigns(signs []*PbftSign)
- func (b *Block) Bloom() Bloom
- func (b *Block) Body() *Body
- func (b *Block) Coinbase() common.Address
- func (b *Block) CommitteeHash() common.Hash
- func (b *Block) DecodeRLP(s *rlp.Stream) error
- func (b *Block) EncodeRLP(w io.Writer) error
- func (b *Block) Extra() []byte
- func (b *Block) GasLimit() uint64
- func (b *Block) GasUsed() uint64
- func (b *Block) GetLeaderSign() *PbftSign
- func (b *Block) GetLocalSigns() (PbftSigns, PbftSigns)
- func (b *Block) GetSignHash() common.Hash
- func (b *Block) Hash() common.Hash
- func (b *Block) Header() *Header
- func (b *Block) IsAward() bool
- func (b *Block) IsProposal() bool
- func (b *Block) IsSwitch() bool
- func (b *Block) Number() *big.Int
- func (b *Block) NumberU64() uint64
- func (b *Block) ParentHash() common.Hash
- func (b *Block) Proposer() common.Address
- func (b *Block) ReceiptHash() common.Hash
- func (b *Block) Root() common.Hash
- func (b *Block) SetSign(signs []*PbftSign)
- func (b *Block) SetSignInfosByPrevBlock(prev *Block)
- func (b *Block) SignedHash() common.Hash
- func (b *Block) Signs() []*PbftSign
- func (b *Block) Size() common.StorageSize
- func (b *Block) SnailHash() common.Hash
- func (b *Block) SnailNumber() *big.Int
- func (b *Block) SwitchInfos() []*CommitteeMember
- func (b *Block) Time() *big.Int
- func (b *Block) Transaction(hash common.Hash) *Transaction
- func (b *Block) Transactions() Transactions
- func (b *Block) TxHash() common.Hash
- func (b *Block) UncleHash() common.Hash
- func (b *Block) UpdateSnailHash(h common.Hash)
- func (b *Block) WithBody(transactions []*Transaction, signs []*PbftSign, infos []*CommitteeMember) *Block
- func (b *Block) WithSeal(header *Header) *Block
- type BlockBalance
- type BlockBy
- type BlockNonce
- type BlockReward
- type Blocks
- type Bloom
- func (b *Bloom) Add(d *big.Int)
- func (b Bloom) Big() *big.Int
- func (b Bloom) Bytes() []byte
- func (b Bloom) MarshalText() ([]byte, error)
- func (b *Bloom) SetBytes(d []byte)
- func (b Bloom) Test(test *big.Int) bool
- func (b Bloom) TestBytes(test []byte) bool
- func (b *Bloom) UnmarshalText(input []byte) error
- type Body
- type ChainReward
- type CommitteeInfo
- type CommitteeMember
- type CommitteeMembers
- type CommitteeNode
- type CommitteeNodeTag
- type DerivableList
- type ElectionCommittee
- type ElectionEvent
- type EncryptCommitteeNode
- type EncryptNodeMessage
- func (c *EncryptNodeMessage) DecodeRLP(s *rlp.Stream) error
- func (c *EncryptNodeMessage) EncodeRLP(w io.Writer) error
- func (c *EncryptNodeMessage) Hash() common.Hash
- func (c *EncryptNodeMessage) HashWithoutSign() common.Hash
- func (c *EncryptNodeMessage) Size() common.StorageSize
- func (c *EncryptNodeMessage) String(str string)
- type EpochIDInfo
- type FastBalanceChangeContent
- type FastChainEvent
- type FastChainHeadEvent
- type FastChainSideEvent
- type FruitEvent
- type Fruits
- type FruitsHeaders
- type GenesisAccount
- type GenesisAlloc
- type GenesisMismatchError
- type Header
- type ImpawnSummay
- type LockedItem
- type LockedValue
- type Log
- type LogForStorage
- type Message
- func (m Message) CheckNonce() bool
- func (m Message) Data() []byte
- func (m Message) Fee() *big.Int
- func (m Message) From() common.Address
- func (m Message) Gas() uint64
- func (m Message) GasPrice() *big.Int
- func (m Message) Nonce() uint64
- func (m Message) Payment() common.Address
- func (m Message) To() *common.Address
- func (m Message) Value() *big.Int
- type NewFastBlocksEvent
- type NewFruitsEvent
- type NewMinedBlockEvent
- type NewMinedFruitEvent
- type NewTxsEvent
- type NodeInfoEvent
- type PbftAgentProxy
- type PbftServerProxy
- type PbftSign
- func (c *PbftSign) DecodeRLP(s *rlp.Stream) error
- func (p *PbftSign) EncodeRLP(w io.Writer) error
- func (s *PbftSign) Equal(b *PbftSign) bool
- func (h *PbftSign) Hash() common.Hash
- func (h *PbftSign) HashWithNoSign() common.Hash
- func (p PbftSign) MarshalJSON() ([]byte, error)
- func (s *PbftSign) String() string
- func (p *PbftSign) UnmarshalJSON(input []byte) error
- type PbftSignEvent
- type PbftSigns
- type PendingLogsEvent
- type PendingStateEvent
- type RawTransaction
- type Receipt
- type ReceiptForStorage
- type Receipts
- type RemovedLogsEvent
- type RewardInfo
- type SARewardInfos
- type Sign
- type Signer
- type SnailBlock
- func (b *SnailBlock) BlockDifficulty() *big.Int
- func (b *SnailBlock) Body() *SnailBody
- func (b *SnailBlock) Coinbase() common.Address
- func (b *SnailBlock) DecodeRLP(s *rlp.Stream) error
- func (b *SnailBlock) DeprecatedTd() *big.Int
- func (b *SnailBlock) Difficulty() *big.Int
- func (b *SnailBlock) EncodeRLP(w io.Writer) error
- func (b *SnailBlock) Extra() []byte
- func (b *SnailBlock) FastHash() common.Hash
- func (b *SnailBlock) FastNumber() *big.Int
- func (b *SnailBlock) FruitDifficulty() *big.Int
- func (b *SnailBlock) Fruits() []*SnailBlock
- func (b *SnailBlock) FruitsHash() common.Hash
- func (b *SnailBlock) GetPubKey() (*ecdsa.PublicKey, error)
- func (b *SnailBlock) Hash() common.Hash
- func (b *SnailBlock) HashNoNonce() common.Hash
- func (b *SnailBlock) Header() *SnailHeader
- func (b *SnailBlock) IsFruit() bool
- func (b *SnailBlock) MaxFruitNumber() *big.Int
- func (b *SnailBlock) MinFruitNumber() *big.Int
- func (b *SnailBlock) MixDigest() common.Hash
- func (b *SnailBlock) Nonce() uint64
- func (b *SnailBlock) Number() *big.Int
- func (b *SnailBlock) NumberU64() uint64
- func (b *SnailBlock) ParentHash() common.Hash
- func (b *SnailBlock) PointNumber() *big.Int
- func (b *SnailBlock) PointerHash() common.Hash
- func (b *SnailBlock) PublicKey() []byte
- func (b *SnailBlock) SetSnailBlockFruits(fruits Fruits)
- func (b *SnailBlock) SetSnailBlockSigns(signs []*PbftSign)
- func (b *SnailBlock) Signs() PbftSigns
- func (b *SnailBlock) Size() common.StorageSize
- func (b *SnailBlock) Time() *big.Int
- func (b *SnailBlock) ToElect() bool
- func (b *SnailBlock) WithBody(fruits []*SnailBlock, uncles []*SnailHeader) *SnailBlock
- func (b *SnailBlock) WithSeal(header *SnailHeader) *SnailBlock
- type SnailBlockBy
- type SnailBlocks
- type SnailBody
- type SnailChainEvent
- type SnailChainHeadEvent
- type SnailChainSideEvent
- type SnailHeader
- type SnailRewardContenet
- type StakingValue
- type SummayEpochInfo
- type SwitchEnter
- type SwitchEnters
- type SwitchInfos
- type TIP1Signer
- func (s TIP1Signer) Equal(s2 Signer) bool
- func (s TIP1Signer) Hash(tx *Transaction) common.Hash
- func (s TIP1Signer) Hash_Payment(tx *Transaction) common.Hash
- func (s TIP1Signer) Payer(tx *Transaction) (common.Address, error)
- func (s TIP1Signer) Sender(tx *Transaction) (common.Address, error)
- func (s TIP1Signer) SignatureValues(tx *Transaction, sig []byte) (R, S, V *big.Int, err error)
- type TimedChainReward
- type Transaction
- func NewContractCreation(nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte) *Transaction
- func NewContractCreation_Payment(nonce uint64, amount *big.Int, fee *big.Int, gasLimit uint64, ...) *Transaction
- func NewTransaction(nonce uint64, to common.Address, amount *big.Int, gasLimit uint64, ...) *Transaction
- func NewTransaction_Payment(nonce uint64, to common.Address, amount *big.Int, fee *big.Int, ...) *Transaction
- func SignTx(tx *Transaction, s Signer, prv *ecdsa.PrivateKey) (*Transaction, error)
- func SignTx_Payment(tx *Transaction, s Signer, prv *ecdsa.PrivateKey) (*Transaction, error)
- func (tx *Transaction) AmountCost() *big.Int
- func (tx *Transaction) AsMessage(s Signer) (Message, error)
- func (tx *Transaction) ChainId() *big.Int
- func (tx *Transaction) CheckNonce() bool
- func (tx *Transaction) ConvertRawTransaction() *RawTransaction
- func (tx *Transaction) Cost() *big.Int
- func (tx *Transaction) Data() []byte
- func (tx *Transaction) DecodeRLP(s *rlp.Stream) error
- func (tx *Transaction) EncodeRLP(w io.Writer) error
- func (tx *Transaction) Fee() *big.Int
- func (tx *Transaction) Gas() uint64
- func (tx *Transaction) GasCost() *big.Int
- func (tx *Transaction) GasPrice() *big.Int
- func (tx *Transaction) Hash() common.Hash
- func (tx *Transaction) Info() string
- func (tx *Transaction) MarshalJSON() ([]byte, error)
- func (tx *Transaction) Nonce() uint64
- func (tx *Transaction) Payer() *common.Address
- func (tx *Transaction) Protected() bool
- func (tx *Transaction) Protected_Payment() bool
- func (tx *Transaction) RawSignatureValues() (*big.Int, *big.Int, *big.Int)
- func (tx *Transaction) Size() common.StorageSize
- func (tx *Transaction) To() *common.Address
- func (tx *Transaction) TrueRawSignatureValues() (*big.Int, *big.Int, *big.Int)
- func (tx *Transaction) UnmarshalJSON(input []byte) error
- func (tx *Transaction) Value() *big.Int
- func (tx *Transaction) WithSignature(signer Signer, sig []byte) (*Transaction, error)
- func (tx *Transaction) WithSignature_Payment(signer Signer, sig []byte) (*Transaction, error)
- type Transactions
- type TransactionsByPriceAndNonce
- type TransportCommitteeNode
- type TxByNonce
- type TxByPrice
Constants ¶
const ( // BloomByteLength represents the number of bytes used in a header log bloom. BloomByteLength = 256 // BloomBitLength represents the number of bits used in a header log bloom. BloomBitLength = 8 * BloomByteLength )
const ( // CommitteeStart start pbft consensus CommitteeStart = iota // CommitteeStop stop pbft consensus CommitteeStop // CommitteeSwitchover switch pbft committee CommitteeSwitchover // CommitteeUpdate update committee members and backups CommitteeUpdate // CommitteeOver notify current pbft committee end fastBlock CommitteeOver StateUnusedFlag = 0xa0 StateUsedFlag = 0xa1 StateSwitchingFlag = 0xa2 StateRemovedFlag = 0xa3 StateAppendFlag = 0xa4 // health enter type TypeFixed = 0xa1 TypeWorked = 0xa2 TypeBack = 0xa3 )
const ( //VoteAgreeAgainst vote sign with against VoteAgreeAgainst = iota //VoteAgree vote sign with agree VoteAgree Normal = iota FetcherCall DownloaderCall SFetcherCall SDownloaderCall PeerSendCall FetcherHeadCall SFetcherHeadCall DownloaderFetchCall DownloaderPartCall SDownloaderFetchCall SDownloaderLoopCall SDownloaderPartCall )
const ( // StateStakingOnce can be election only once StateStakingOnce uint8 = 1 << iota // StateStakingAuto can be election in every epoch StateStakingAuto StateStakingCancel // StateRedeem can be redeem real time (after MaxRedeemHeight block) StateRedeem // StateRedeemed flag the asset which is staking in the height is redeemed StateRedeemed )
const ( OpQueryStaking uint8 = 1 << iota OpQueryLocked OpQueryCancelable )
const ( // ReceiptStatusFailed is the status code of a transaction if execution failed. ReceiptStatusFailed = uint64(0) // ReceiptStatusSuccessful is the status code of a transaction if execution succeeded. ReceiptStatusSuccessful = uint64(1) )
Variables ¶
var ( EmptyRootHash = DeriveSha(Transactions{}) EmptyUncleHash = CalcUncleHash(nil) EmptySignHash = CalcSignHash(nil) )
var ( // ErrHeightNotYet When the height of the committee is higher than the local height, it is issued. ErrHeightNotYet = errors.New("pbft send block height not yet") // ErrSnailHeightNotYet Snail height not yet ErrSnailHeightNotYet = errors.New("Snail height not yet") //ErrSnailBlockNotOnTheCain Snail block not on the cain ErrSnailBlockNotOnTheCain = errors.New("Snail block not on the chain") //ErrSnailBlockTooSlow Snail block too slow ErrSnailBlockTooSlow = errors.New("Snail block too slow") ErrPayersign = errors.New("signed_addr not equal tx.data.Payer") )
var ( Base = new(big.Int).SetUint64(10000) InvalidFee = big.NewInt(65535) // StakingAddress is defined as Address('truestaking') // i.e. contractAddress = 0x000000000000000000747275657374616b696E67 StakingAddress = common.BytesToAddress([]byte("truestaking")) MixEpochCount = 2 )
var ( ErrInvalidParam = errors.New("Invalid Param") ErrOverEpochID = errors.New("Over epoch id") ErrNotSequential = errors.New("epoch id not sequential") ErrInvalidEpochInfo = errors.New("Invalid epoch info") ErrNotFoundEpoch = errors.New("cann't found the epoch info") ErrInvalidStaking = errors.New("Invalid staking account") ErrMatchEpochID = errors.New("wrong match epoch id in a reward block") ErrNotStaking = errors.New("Not match the staking account") ErrNotDelegation = errors.New("Not match the delegation account") ErrNotMatchEpochInfo = errors.New("the epoch info is not match with accounts") ErrNotElectionTime = errors.New("not time to election the next committee") ErrAmountOver = errors.New("the amount more than staking amount") ErrDelegationSelf = errors.New("Cann't delegation myself") ErrRedeemAmount = errors.New("wrong redeem amount") ErrForbidAddress = errors.New("Forbidding Address") ErrRepeatPk = errors.New("repeat PK on staking tx") )
var Bloom9 = bloom9
var (
ErrInvalidChainId = errors.New("invalid chain id for signer")
)
var (
ErrInvalidSig = errors.New("invalid transaction v, r, s values")
)
Functions ¶
func BloomLookup ¶
func CalcSignHash ¶
func CalcUncleHash ¶
func CopyVotePk ¶
func DeriveSha ¶
func DeriveSha(list DerivableList) common.Hash
func FetchOneToAbey ¶
func FetchOneToAbey(sas []*SARewardInfos, addr common.Address) map[string]interface{}
func ForbidAddress ¶
func FromBlock ¶
func FromBlock(block *SnailBlock) (begin, end uint64)
func FruitNumber ¶
func FruitNumber(b1, b2 *SnailBlock) bool
func IsUnlocked ¶
func MergeReward ¶
func MinCalcRedeemHeight ¶
func Payer ¶
func Payer(signer Signer, tx *Transaction) (common.Address, error)
PSender returns the address derived from the signature (PV, PR, PS) using secp256k1 elliptic curve and an error if it failed deriving or upon an incorrect signature.
func Sender ¶
func Sender(signer Signer, tx *Transaction) (common.Address, error)
Sender returns the address derived from the signature (V, R, S) using secp256k1 elliptic curve and an error if it failed deriving or upon an incorrect signature.
Sender may cache the address, allowing it to be used regardless of signing method. The cache is invalidated if the cached signer does not match the signer used in the current call.
func SignatureValues ¶
func SignatureValues(tx *Transaction, sig []byte) (r, s, v *big.Int, err error)
func SnailNumber ¶
func SnailNumber(b1, b2 *SnailBlock) bool
func ToJSON ¶
func ToJSON(ii *ImpawnSummay) map[string]interface{}
Types ¶
type BalanceChangeContent ¶
type BalanceInfo ¶
type BalanceInfo struct { Address common.Address `json:"address"` Valid *big.Int `json:"valid"` Lock *big.Int `json:"lock"` }
func ToBalanceInfos ¶
func ToBalanceInfos(items map[common.Address]*BalanceInfo) []*BalanceInfo
type Block ¶
type Block struct { // These fields are used by package abey to track // inter-peer block relay. ReceivedAt time.Time ReceivedFrom interface{} // contains filtered or unexported fields }
Block represents an entire block in the abeychain blockchain.
func NewBlock ¶
func NewBlock(header *Header, txs []*Transaction, receipts []*Receipt, signs []*PbftSign, infos []*CommitteeMember) *Block
NewBlock creates a new fast block. The input data is copied, changes to header and to the field values will not affect the block.
The values of TxHash, ReceiptHash and Bloom in header are ignored and set to values derived from the given txs and receipts.
func NewBlockWithHeader ¶
NewBlockWithHeader creates a fast block with the given header data. The header data is copied, changes to header and to the field values will not affect the block.
func NewLesRawBlock ¶
func NewLesRawBlock(header *Header, infos []*CommitteeMember) *Block
func (*Block) AppendSign ¶
func (*Block) AppendSigns ¶
func (*Block) CommitteeHash ¶
func (*Block) GetLeaderSign ¶
func (*Block) GetLocalSigns ¶
func (*Block) GetSignHash ¶
func (*Block) Hash ¶
Hash returns the keccak256 hash of b's header. The hash is computed on the first call and cached thereafter.
func (*Block) IsProposal ¶
Condition when proposal block award or switch is not nil
func (*Block) ParentHash ¶
func (*Block) ReceiptHash ¶
func (*Block) SetSignInfosByPrevBlock ¶
func (*Block) SignedHash ¶
func (*Block) Size ¶
func (b *Block) Size() common.StorageSize
Size returns the true RLP encoded storage size of the block, either by encoding and returning it, or returning a previsouly cached value.
func (*Block) SnailNumber ¶
func (*Block) SwitchInfos ¶
func (b *Block) SwitchInfos() []*CommitteeMember
func (*Block) Transaction ¶
func (b *Block) Transaction(hash common.Hash) *Transaction
func (*Block) Transactions ¶
func (b *Block) Transactions() Transactions
func (*Block) UpdateSnailHash ¶
func (*Block) WithBody ¶
func (b *Block) WithBody(transactions []*Transaction, signs []*PbftSign, infos []*CommitteeMember) *Block
WithBody returns a new block with the given transaction contents.
type BlockBalance ¶
type BlockBalance struct {
Balance []*BalanceInfo `json:"addrWithBalance" gencodec:"required"`
}
func (*BlockBalance) ToMap ¶
func (s *BlockBalance) ToMap() map[common.Address]*BalanceInfo
type BlockNonce ¶
type BlockNonce [8]byte
A BlockNonce is a 64-bit hash which proves (combined with the mix-hash) that a sufficient amount of computation has been carried out on a block.
func EncodeNonce ¶
func EncodeNonce(i uint64) BlockNonce
EncodeNonce converts the given integer to a block nonce.
func (BlockNonce) MarshalText ¶
func (n BlockNonce) MarshalText() ([]byte, error)
MarshalText encodes n as a hex string with 0x prefix.
func (BlockNonce) Uint64 ¶
func (n BlockNonce) Uint64() uint64
Uint64 returns the integer value of a block nonce.
func (*BlockNonce) UnmarshalText ¶
func (n *BlockNonce) UnmarshalText(input []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
type BlockReward ¶
type BlockReward struct { FastHash common.Hash `json:"FastHash" gencodec:"required"` FastNumber *big.Int `json:"FastNumber" gencodec:"required"` SnailHash common.Hash `json:"SnailHash" gencodec:"required"` SnailNumber *big.Int `json:"SnailNumber" gencodec:"required"` }
BlockReward
type Bloom ¶
type Bloom [BloomByteLength]byte
Bloom represents a 2048 bit bloom filter.
func BytesToBloom ¶
BytesToBloom converts a byte slice to a bloom filter. It panics if b is not of suitable size.
func CreateBloom ¶
func (Bloom) MarshalText ¶
MarshalText encodes b as a hex string with 0x prefix.
func (*Bloom) SetBytes ¶
SetBytes sets the content of b to the given bytes. It panics if d is not of suitable size.
func (*Bloom) UnmarshalText ¶
UnmarshalText b as a hex string with 0x prefix.
type Body ¶
type Body struct { Transactions []*Transaction Signs []*PbftSign Infos []*CommitteeMember }
Body is a simple (mutable, non-safe) data container for storing and moving a block's data contents (transactions and uncles) together.
func (*Body) GetSwitchInfo ¶
func (b *Body) GetSwitchInfo() []*CommitteeMember
GetSwitchInfo get info for shift committee
func (*Body) SetLeaderSign ¶
SetLeaderSign keep the sign on the head for proposal
func (*Body) SetSwitchInfo ¶
func (b *Body) SetSwitchInfo(infos []*CommitteeMember)
SetSwitchInfo set info for shift committee
type ChainReward ¶
type ChainReward struct { Height uint64 St uint64 CoinBase *RewardInfo `json:"blockminer"` FruitBase []*RewardInfo `json:"fruitminer"` CommitteeBase []*SARewardInfos `json:"committeeReward"` }
func CloneChainReward ¶
func CloneChainReward(reward *ChainReward) *ChainReward
func NewChainReward ¶
func NewChainReward(height, tt uint64, coin *RewardInfo, fruits []*RewardInfo, committee []*SARewardInfos) *ChainReward
func (*ChainReward) CoinRewardInfo ¶
func (s *ChainReward) CoinRewardInfo() map[string]interface{}
func (*ChainReward) CommitteeRewardInfo ¶
func (s *ChainReward) CommitteeRewardInfo() map[string]interface{}
func (*ChainReward) FruitRewardInfo ¶
func (s *ChainReward) FruitRewardInfo() map[string]interface{}
type CommitteeInfo ¶
type CommitteeInfo struct { Id *big.Int StartHeight *big.Int EndHeight *big.Int Members []*CommitteeMember BackMembers []*CommitteeMember }
func CopyCommitteeInfo ¶
func CopyCommitteeInfo(committeeInfo *CommitteeInfo) *CommitteeInfo
func (*CommitteeInfo) GetAllMembers ¶
func (c *CommitteeInfo) GetAllMembers() []*CommitteeMember
func (*CommitteeInfo) String ¶
func (c *CommitteeInfo) String() string
type CommitteeMember ¶
type CommitteeMember struct { Coinbase common.Address `json:"coinbase` CommitteeBase common.Address `json:"committeebase` Publickey []byte Flag uint32 MType uint32 }
func NewCommitteeMember ¶
func NewCommitteeMember(coinBase common.Address, publicKey []byte, flag, mType uint32) *CommitteeMember
func (*CommitteeMember) Compared ¶
func (c *CommitteeMember) Compared(d *CommitteeMember) bool
func (*CommitteeMember) String ¶
func (c *CommitteeMember) String() string
func (*CommitteeMember) UnmarshalJSON ¶
func (c *CommitteeMember) UnmarshalJSON(input []byte) error
type CommitteeNode ¶
type CommitteeNode struct { IP string Port uint32 Port2 uint32 Coinbase common.Address Publickey []byte }
CommitteeNode contains main info of committee node
func (*CommitteeNode) ConvertCommitteeNodeToTransport ¶
func (cn *CommitteeNode) ConvertCommitteeNodeToTransport() *TransportCommitteeNode
func (*CommitteeNode) String ¶
func (c *CommitteeNode) String() string
type CommitteeNodeTag ¶
func (*CommitteeNodeTag) Hash ¶
func (c *CommitteeNodeTag) Hash() common.Hash
type DerivableList ¶
type ElectionCommittee ¶
type ElectionCommittee struct { Members []*CommitteeMember Backups []*CommitteeMember }
ElectionCommittee defines election members result
type ElectionEvent ¶
type ElectionEvent struct { Option uint CommitteeID *big.Int CommitteeMembers []*CommitteeMember BackupMembers []*CommitteeMember BeginFastNumber *big.Int EndFastNumber *big.Int }
type EncryptCommitteeNode ¶
type EncryptCommitteeNode []byte
EncryptCommitteeNode represent a committee member encrypt info which encrypt committeeNode with member Publickey
type EncryptNodeMessage ¶
type EncryptNodeMessage struct { CreatedAt *big.Int CommitteeID *big.Int Nodes []EncryptCommitteeNode Sign //sign msg // contains filtered or unexported fields }
EncryptNodeMessage all information of the committee
func (*EncryptNodeMessage) DecodeRLP ¶
func (c *EncryptNodeMessage) DecodeRLP(s *rlp.Stream) error
DecodeRLP decodes the abeychain
func (*EncryptNodeMessage) EncodeRLP ¶
func (c *EncryptNodeMessage) EncodeRLP(w io.Writer) error
EncodeRLP serializes b into the abeychain RLP block format.
func (*EncryptNodeMessage) Hash ¶
func (c *EncryptNodeMessage) Hash() common.Hash
func (*EncryptNodeMessage) HashWithoutSign ¶
func (c *EncryptNodeMessage) HashWithoutSign() common.Hash
func (*EncryptNodeMessage) Size ¶
func (c *EncryptNodeMessage) Size() common.StorageSize
func (*EncryptNodeMessage) String ¶
func (c *EncryptNodeMessage) String(str string)
type EpochIDInfo ¶
func GetEpochFromHeight ¶
func GetEpochFromHeight(hh uint64) *EpochIDInfo
func GetEpochFromID ¶
func GetEpochFromID(eid uint64) *EpochIDInfo
func GetEpochFromRange ¶
func GetEpochFromRange(begin, end uint64) []*EpochIDInfo
func GetFirstEpoch ¶
func GetFirstEpoch() *EpochIDInfo
func GetPreFirstEpoch ¶
func GetPreFirstEpoch() *EpochIDInfo
func (*EpochIDInfo) String ¶
func (e *EpochIDInfo) String() string
type FastBalanceChangeContent ¶
type FastBalanceChangeContent struct {
AddrWithBalance map[common.Address]*BalanceInfo `json:"addrWithBalance" gencodec:"required"`
}
type FastChainHeadEvent ¶
type FastChainHeadEvent struct{ Block *Block }
type FastChainSideEvent ¶
type FastChainSideEvent struct {
Block *Block
}
type FruitEvent ¶
FruitEvent for fruit event,seems not used
type Fruits ¶
type Fruits []*SnailBlock
Fruits is a wrapper around a fruit array to implement DerivableList.
type FruitsHeaders ¶
type FruitsHeaders []*SnailHeader
Headers is a wrapper around a fruit header array to implement DerivableList.
func (FruitsHeaders) GetRlp ¶
func (fs FruitsHeaders) GetRlp(i int) []byte
GetRlp returns the RLP encoding of one fruit header from the list.
func (FruitsHeaders) Len ¶
func (fs FruitsHeaders) Len() int
Len returns the number of headers in this list.
type GenesisAccount ¶
type GenesisAccount struct { Code []byte `json:"code,omitempty"` Storage map[common.Hash]common.Hash `json:"storage,omitempty"` Balance *big.Int `json:"balance" gencodec:"required"` Nonce uint64 `json:"nonce,omitempty"` PrivateKey []byte `json:"secretKey,omitempty"` // for tests }
GenesisAccount is an account in the state of the genesis block.
func (GenesisAccount) MarshalJSON ¶
func (g GenesisAccount) MarshalJSON() ([]byte, error)
func (*GenesisAccount) UnmarshalJSON ¶
func (g *GenesisAccount) UnmarshalJSON(input []byte) error
type GenesisAlloc ¶
type GenesisAlloc map[common.Address]GenesisAccount
func DecodePrealloc ¶
func DecodePrealloc(data string) GenesisAlloc
func (*GenesisAlloc) UnmarshalJSON ¶
func (ga *GenesisAlloc) UnmarshalJSON(data []byte) error
type GenesisMismatchError ¶
GenesisMismatchError is raised when trying to overwrite an existing genesis block with an incompatible one.
func (*GenesisMismatchError) Error ¶
func (e *GenesisMismatchError) Error() string
type Header ¶
type Header struct { ParentHash common.Hash `json:"parentHash" gencodec:"required"` Root common.Hash `json:"stateRoot" gencodec:"required"` TxHash common.Hash `json:"transactionsRoot" gencodec:"required"` ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"` CommitteeHash common.Hash `json:"committeeRoot" gencodec:"required"` Proposer common.Address `json:"miner" gencodec:"required"` Bloom Bloom `json:"logsBloom" gencodec:"required"` SnailHash common.Hash `json:"snailHash" gencodec:"required"` SnailNumber *big.Int `json:"snailNumber" gencodec:"required"` Number *big.Int `json:"number" gencodec:"required"` GasLimit uint64 `json:"gasLimit" gencodec:"required"` GasUsed uint64 `json:"gasUsed" gencodec:"required"` Time *big.Int `json:"timestamp" gencodec:"required"` Extra []byte `json:"extraData" gencodec:"required"` }
Header represents a block header in the true blockchain.
func CopyHeader ¶
CopyHeader creates a deep copy of a fast block header to prevent side effects from modifying a header variable.
func (*Header) Hash ¶
Hash returns the block hash of the header, which is simply the keccak256 hash of its RLP encoding.
func (Header) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*Header) Size ¶
func (h *Header) Size() common.StorageSize
Size returns the approximate memory used by all internal contents. It is used to approximate and limit the memory consumption of various caches.
func (*Header) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type ImpawnSummay ¶
type ImpawnSummay struct { LastReward uint64 Accounts uint64 AllAmount *big.Int Infos []*SummayEpochInfo }
type LockedItem ¶
type LockedValue ¶
type LockedValue struct {
Value map[uint64]*LockedItem
}
LockedValue,the key of Value is epochid
type Log ¶
type Log struct { // Consensus fields: // address of the contract that generated the event Address common.Address `json:"address" gencodec:"required"` // list of topics provided by the contract. Topics []common.Hash `json:"topics" gencodec:"required"` // supplied by the contract, usually ABI-encoded Data []byte `json:"data" gencodec:"required"` // Derived fields. These fields are filled in by the node // but not secured by consensus. // block in which the transaction was included BlockNumber uint64 `json:"blockNumber"` // hash of the transaction TxHash common.Hash `json:"transactionHash" gencodec:"required"` // index of the transaction in the block TxIndex uint `json:"transactionIndex" gencodec:"required"` // hash of the block in which the transaction was included BlockHash common.Hash `json:"blockHash"` // index of the log in the receipt Index uint `json:"logIndex" gencodec:"required"` // The Removed field is true if this log was reverted due to a chain reorganisation. // You must pay attention to this field if you receive logs through a filter query. Removed bool `json:"removed"` }
Log represents a contract log event. These events are generated by the LOG opcode and stored/indexed by the node.
func (Log) MarshalJSON ¶
func (*Log) UnmarshalJSON ¶
type LogForStorage ¶
type LogForStorage Log
LogForStorage is a wrapper around a Log that flattens and parses the entire content of a log including non-consensus fields.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message is a fully derived transaction and implements core.Message
NOTE: In a future PR this will be removed.
func NewMessage ¶
func (Message) CheckNonce ¶
type NewFastBlocksEvent ¶
type NewFastBlocksEvent struct{ FastBlocks []*Block }
NewFastBlocksEvent is posted when a block has been imported.
type NewFruitsEvent ¶
type NewFruitsEvent struct{ Fruits []*SnailBlock }
NewFruitsEvent is posted when a fruit has been imported.
type NewMinedBlockEvent ¶
type NewMinedBlockEvent struct{ Block *SnailBlock }
NewMinedBlockEvent is posted when a block has been imported.
type NewMinedFruitEvent ¶
type NewMinedFruitEvent struct{ Block *SnailBlock }
NewMinedFruitEvent is posted when a block has been Mined.
type NewTxsEvent ¶
type NewTxsEvent struct{ Txs []*Transaction }
NewTxsEvent is posted when a batch of transactions enter the transaction pool.
type NodeInfoEvent ¶
type NodeInfoEvent struct{ NodeInfo *EncryptNodeMessage }
NodeInfoEvent is posted when nodeInfo send
type PbftAgentProxy ¶
type PbftAgentProxy interface { FetchFastBlock(committeeId *big.Int, infos []*CommitteeMember) (*Block, error) VerifyFastBlock(*Block, bool) (*PbftSign, error) BroadcastConsensus(block *Block) error GetCurrentHeight() *big.Int GetSeedMember() []*CommitteeMember GetFastLastProposer() common.Address }
type PbftServerProxy ¶
type PbftServerProxy interface { PutCommittee(committeeInfo *CommitteeInfo) error UpdateCommittee(info *CommitteeInfo) error PutNodes(id *big.Int, nodes []*CommitteeNode) error Notify(id *big.Int, action int) error SetCommitteeStop(committeeId *big.Int, stop uint64) error GetCommitteeStatus(committeeID *big.Int) map[string]interface{} IsLeader(committeeID *big.Int) bool }
type PbftSign ¶
type PbftSign struct { FastHeight *big.Int FastHash common.Hash // fastblock hash Result uint32 // 0--against,1--agree Sign []byte // sign for fastblock height + hash + result // contains filtered or unexported fields }
func CopyPbftSign ¶
func (*PbftSign) Hash ¶
Hash returns the block hash of the PbftSign, which is simply the keccak256 hash of its RLP encoding.
func (*PbftSign) HashWithNoSign ¶
HashWithNoSign returns the hash which PbftSign without sign
func (PbftSign) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*PbftSign) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type PbftSignEvent ¶
type PendingLogsEvent ¶
type PendingLogsEvent struct {
Logs []*Log
}
PendingLogsEvent is posted pre mining and notifies of pending logs.
type PendingStateEvent ¶
type PendingStateEvent struct{}
PendingStateEvent is posted pre mining and notifies of pending state changes.
type RawTransaction ¶
type RawTransaction struct {
// contains filtered or unexported fields
}
func NewRawTransaction ¶
func (*RawTransaction) ConvertTransaction ¶
func (rawTransaction *RawTransaction) ConvertTransaction() *Transaction
func (*RawTransaction) DecodeRLP ¶
func (tx *RawTransaction) DecodeRLP(s *rlp.Stream) error
DecodeRLP implements rlp.Decoder
func (*RawTransaction) EncodeRLP ¶
func (tx *RawTransaction) EncodeRLP(w io.Writer) error
EncodeRLP implements rlp.Encoder
func (*RawTransaction) Info ¶
func (tx *RawTransaction) Info() string
type Receipt ¶
type Receipt struct { // Consensus fields PostState []byte `json:"root"` Status uint64 `json:"status"` CumulativeGasUsed uint64 `json:"cumulativeGasUsed" gencodec:"required"` Bloom Bloom `json:"logsBloom" gencodec:"required"` Logs []*Log `json:"logs" gencodec:"required"` // Implementation fields (don't reorder!) TxHash common.Hash `json:"transactionHash" gencodec:"required"` ContractAddress common.Address `json:"contractAddress"` GasUsed uint64 `json:"gasUsed" gencodec:"required"` // Inclusion information: These fields provide information about the inclusion of the // transaction corresponding to this receipt. BlockHash common.Hash `json:"blockHash,omitempty"` BlockNumber *big.Int `json:"blockNumber,omitempty"` TransactionIndex uint `json:"transactionIndex"` }
Receipt represents the results of a transaction.
func NewReceipt ¶
NewReceipt creates a barebone transaction receipt, copying the init fields.
func (*Receipt) DecodeRLP ¶
DecodeRLP implements rlp.Decoder, and loads the consensus fields of a receipt from an RLP stream.
func (*Receipt) EncodeRLP ¶
EncodeRLP implements rlp.Encoder, and flattens the consensus fields of a receipt into an RLP stream. If no post state is present, byzantium fork is assumed.
func (Receipt) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*Receipt) Size ¶
func (r *Receipt) Size() common.StorageSize
Size returns the approximate memory used by all internal contents. It is used to approximate and limit the memory consumption of various caches.
func (*Receipt) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type ReceiptForStorage ¶
type ReceiptForStorage Receipt
ReceiptForStorage is a wrapper around a Receipt that flattens and parses the entire content of a receipt, as opposed to only the consensus fields originally.
type Receipts ¶
type Receipts []*Receipt
Receipts is a wrapper around a Receipt array to implement DerivableList.
type RemovedLogsEvent ¶
type RemovedLogsEvent struct{ Logs []*Log }
RemovedLogsEvent is posted when a reorg happens
type RewardInfo ¶
type RewardInfo struct { Address common.Address `json:"Address"` Amount *big.Int `json:"Amount"` Staking *big.Int `json:"Staking"` }
func FetchOne ¶
func FetchOne(sas []*SARewardInfos, addr common.Address) []*RewardInfo
func ToRewardInfos1 ¶
func ToRewardInfos1(items map[common.Address]*big.Int) []*RewardInfo
func (*RewardInfo) String ¶
func (e *RewardInfo) String() string
func (*RewardInfo) ToJson ¶
func (e *RewardInfo) ToJson() map[string]interface{}
type SARewardInfos ¶
type SARewardInfos struct {
Items []*RewardInfo `json:"Items"`
}
func ToRewardInfos2 ¶
func ToRewardInfos2(items map[common.Address]*big.Int) []*SARewardInfos
func (*SARewardInfos) String ¶
func (s *SARewardInfos) String() string
func (*SARewardInfos) StringToAbey ¶
func (s *SARewardInfos) StringToAbey() map[string]interface{}
type Signer ¶
type Signer interface { // Sender returns the sender address of the transaction. Sender(tx *Transaction) (common.Address, error) // PSender returns the paid address of the transaction. Payer(tx *Transaction) (common.Address, error) // SignatureValues returns the raw R, S, V values corresponding to the // given signature. SignatureValues(tx *Transaction, sig []byte) (r, s, v *big.Int, err error) // Hash returns the hash to be signed. Hash(tx *Transaction) common.Hash Hash_Payment(tx *Transaction) common.Hash // Equal returns true if the given signer is the same as the receiver. Equal(Signer) bool }
Signer encapsulates transaction signature handling. Note that this interface is not a stable API and may change at any time to accommodate new protocol rules.
func MakeSigner ¶
func MakeSigner(config *params.ChainConfig, blockNumber *big.Int) Signer
MakeSigner returns a Signer based on the given chain config and block number.
type SnailBlock ¶
type SnailBlock struct { // These fields are used by package abey to track // inter-peer block relay. ReceivedAt time.Time ReceivedFrom interface{} // contains filtered or unexported fields }
SnailBlock represents an entire snail block in the AbeyChain snail chain.
func CopyFruit ¶
func CopyFruit(f *SnailBlock) *SnailBlock
func NewSnailBlock ¶
func NewSnailBlock(header *SnailHeader, fruits []*SnailBlock, signs []*PbftSign, uncles []*SnailHeader, config *params.ChainConfig) *SnailBlock
NewSnailBlock creates a new block. The input data is copied, changes to header and to the field values will not affect the block.
func NewSnailBlockWithHeader ¶
func NewSnailBlockWithHeader(header *SnailHeader) *SnailBlock
NewSnailBlockWithHeader creates a block with the given header data. The header data is copied, changes to header and to the field values will not affect the block.
func (*SnailBlock) BlockDifficulty ¶
func (b *SnailBlock) BlockDifficulty() *big.Int
func (*SnailBlock) Body ¶
func (b *SnailBlock) Body() *SnailBody
Body returns the non-header content of the snailblock. func (b *SnailBlock) Body() *SnailBody { return b.body }
func (*SnailBlock) Coinbase ¶
func (b *SnailBlock) Coinbase() common.Address
func (*SnailBlock) DecodeRLP ¶
func (b *SnailBlock) DecodeRLP(s *rlp.Stream) error
DecodeRLP decodes the SnailBlock
func (*SnailBlock) DeprecatedTd ¶
func (b *SnailBlock) DeprecatedTd() *big.Int
DeprecatedTd is an old relic for extracting the TD of a block. It is in the code solely to facilitate upgrading the database from the old format to the new, after which it should be deleted. Do not use!
func (*SnailBlock) Difficulty ¶
func (b *SnailBlock) Difficulty() *big.Int
func (*SnailBlock) EncodeRLP ¶
func (b *SnailBlock) EncodeRLP(w io.Writer) error
EncodeRLP serializes b into the AbeyChain RLP block format.
func (*SnailBlock) Extra ¶
func (b *SnailBlock) Extra() []byte
func (*SnailBlock) FastHash ¶
func (b *SnailBlock) FastHash() common.Hash
func (*SnailBlock) FastNumber ¶
func (b *SnailBlock) FastNumber() *big.Int
func (*SnailBlock) FruitDifficulty ¶
func (b *SnailBlock) FruitDifficulty() *big.Int
func (*SnailBlock) Fruits ¶
func (b *SnailBlock) Fruits() []*SnailBlock
func (*SnailBlock) FruitsHash ¶
func (b *SnailBlock) FruitsHash() common.Hash
func (*SnailBlock) Hash ¶
func (b *SnailBlock) Hash() common.Hash
Hash returns the keccak256 hash of b's header. The hash is computed on the first call and cached thereafter.
func (*SnailBlock) HashNoNonce ¶
func (b *SnailBlock) HashNoNonce() common.Hash
func (*SnailBlock) Header ¶
func (b *SnailBlock) Header() *SnailHeader
func (*SnailBlock) IsFruit ¶
func (b *SnailBlock) IsFruit() bool
func (*SnailBlock) MaxFruitNumber ¶
func (b *SnailBlock) MaxFruitNumber() *big.Int
func (*SnailBlock) MinFruitNumber ¶
func (b *SnailBlock) MinFruitNumber() *big.Int
func (*SnailBlock) MixDigest ¶
func (b *SnailBlock) MixDigest() common.Hash
func (*SnailBlock) Nonce ¶
func (b *SnailBlock) Nonce() uint64
func (*SnailBlock) Number ¶
func (b *SnailBlock) Number() *big.Int
func (*SnailBlock) NumberU64 ¶
func (b *SnailBlock) NumberU64() uint64
func (*SnailBlock) ParentHash ¶
func (b *SnailBlock) ParentHash() common.Hash
func (*SnailBlock) PointNumber ¶
func (b *SnailBlock) PointNumber() *big.Int
func (*SnailBlock) PointerHash ¶
func (b *SnailBlock) PointerHash() common.Hash
func (*SnailBlock) PublicKey ¶
func (b *SnailBlock) PublicKey() []byte
func (*SnailBlock) SetSnailBlockFruits ¶
func (b *SnailBlock) SetSnailBlockFruits(fruits Fruits)
func (*SnailBlock) SetSnailBlockSigns ¶
func (b *SnailBlock) SetSnailBlockSigns(signs []*PbftSign)
func (*SnailBlock) Signs ¶
func (b *SnailBlock) Signs() PbftSigns
func (*SnailBlock) Size ¶
func (b *SnailBlock) Size() common.StorageSize
Size returns the true RLP encoded storage size of the block, either by encoding and returning it, or returning a previsouly cached value.
func (*SnailBlock) Time ¶
func (b *SnailBlock) Time() *big.Int
func (*SnailBlock) ToElect ¶
func (b *SnailBlock) ToElect() bool
func (*SnailBlock) WithBody ¶
func (b *SnailBlock) WithBody(fruits []*SnailBlock, uncles []*SnailHeader) *SnailBlock
WithBody returns a new snailblock with the given transaction and uncle contents.
func (*SnailBlock) WithSeal ¶
func (b *SnailBlock) WithSeal(header *SnailHeader) *SnailBlock
WithSeal returns a new snailblock with the data from b but the header replaced with the sealed one.
type SnailBlockBy ¶
type SnailBlockBy func(b1, b2 *SnailBlock) bool
func (SnailBlockBy) Sort ¶
func (self SnailBlockBy) Sort(snailBlocks SnailBlocks)
type SnailBlocks ¶
type SnailBlocks []*SnailBlock
type SnailBody ¶
type SnailBody struct { Fruits []*SnailBlock Signs []*PbftSign }
func (*SnailBody) FruitsHeaders ¶
func (b *SnailBody) FruitsHeaders() []*SnailHeader
type SnailChainEvent ¶
type SnailChainEvent struct { Block *SnailBlock Hash common.Hash }
type SnailChainHeadEvent ¶
type SnailChainHeadEvent struct{ Block *SnailBlock }
type SnailChainSideEvent ¶
type SnailChainSideEvent struct {
Block *SnailBlock
}
SnailChainSideEvent is posted when a block in SideStatTy
type SnailHeader ¶
type SnailHeader struct { ParentHash common.Hash `json:"parentHash" gencodec:"required"` Coinbase common.Address `json:"miner" gencodec:"required"` PointerHash common.Hash `json:"pointerHash" gencodec:"required"` PointerNumber *big.Int `json:"pointerNumber" gencodec:"required"` FruitsHash common.Hash `json:"fruitsHash" gencodec:"required"` FastHash common.Hash `json:"fastHash" gencodec:"required"` FastNumber *big.Int `json:"fastNumber" gencodec:"required"` SignHash common.Hash `json:"signHash" gencodec:"required"` Difficulty *big.Int `json:"difficulty" gencodec:"required"` FruitDifficulty *big.Int `json:"fruitDifficulty" gencodec:"required"` Number *big.Int `json:"number" gencodec:"required"` Publickey []byte `json:"publicKey" gencodec:"required"` Time *big.Int `json:"timestamp" gencodec:"required"` Extra []byte `json:"extraData" gencodec:"required"` MixDigest common.Hash `json:"mixHash" gencodec:"required"` Nonce BlockNonce `json:"nonce" gencodec:"required"` }
SnailHeader represents a block header in the abeychain.
func CopySnailHeader ¶
func CopySnailHeader(h *SnailHeader) *SnailHeader
CopySnailHeader creates a deep copy of a snail block header to prevent side effects from modifying a header variable.
func (*SnailHeader) GetDifficulty ¶
GetDifficulty get difficulty by header
func (*SnailHeader) Hash ¶
func (h *SnailHeader) Hash() common.Hash
Hash returns the block hash of the header, which is simply the keccak256 hash of its RLP encoding.
func (*SnailHeader) HashNoNonce ¶
func (h *SnailHeader) HashNoNonce() common.Hash
HashNoNonce returns the hash which is used as input for the proof-of-work search.
func (*SnailHeader) Size ¶
func (h *SnailHeader) Size() common.StorageSize
Size returns the approximate memory used by all internal contents. It is used to approximate and limit the memory consumption of various caches.
type SnailRewardContenet ¶
type SnailRewardContenet struct { BlockMinerReward map[common.Address]*big.Int FruitMinerReward []map[common.Address]*big.Int CommitteeReward map[common.Address]*big.Int }
func (*SnailRewardContenet) RewardInfo ¶
func (s *SnailRewardContenet) RewardInfo() map[string]interface{}
type StakingValue ¶
the key is epochid if StakingValue as a locked asset,otherwise key is block height if StakingValue as a staking asset
func (*StakingValue) ToLockedValue ¶
func (s *StakingValue) ToLockedValue(height uint64) *LockedValue
type SummayEpochInfo ¶
type SwitchEnter ¶
SwitchEnter is the enter inserted in block when committee member changed
func (*SwitchEnter) Equal ¶
func (s *SwitchEnter) Equal(other *SwitchEnter) bool
func (*SwitchEnter) String ¶
func (s *SwitchEnter) String() string
type SwitchEnters ¶
type SwitchEnters []*SwitchEnter
func (SwitchEnters) Equal ¶
func (s SwitchEnters) Equal(other SwitchEnters) bool
Equal will equal not require item index
type SwitchInfos ¶
type SwitchInfos struct { CID *big.Int Members []*CommitteeMember BackMembers []*CommitteeMember Vals []*SwitchEnter }
SwitchInfos is the infos inserted in block when committee member changed
func (*SwitchInfos) Equal ¶
func (s *SwitchInfos) Equal(other *SwitchInfos) bool
func (*SwitchInfos) Hash ¶
func (s *SwitchInfos) Hash() common.Hash
Hash return SwitchInfos hash bytes
func (*SwitchInfos) String ¶
func (s *SwitchInfos) String() string
func (*SwitchInfos) ToHash ¶
func (s *SwitchInfos) ToHash() common.Hash
type TIP1Signer ¶
type TIP1Signer struct {
// contains filtered or unexported fields
}
func NewTIP1Signer ¶
func NewTIP1Signer(chainId *big.Int) TIP1Signer
func (TIP1Signer) Equal ¶
func (s TIP1Signer) Equal(s2 Signer) bool
func (TIP1Signer) Hash ¶
func (s TIP1Signer) Hash(tx *Transaction) common.Hash
Hash returns the hash to be signed by the sender. It does not uniquely identify the transaction.
func (TIP1Signer) Hash_Payment ¶
func (s TIP1Signer) Hash_Payment(tx *Transaction) common.Hash
func (TIP1Signer) Payer ¶
func (s TIP1Signer) Payer(tx *Transaction) (common.Address, error)
func (TIP1Signer) Sender ¶
func (s TIP1Signer) Sender(tx *Transaction) (common.Address, error)
func (TIP1Signer) SignatureValues ¶
func (s TIP1Signer) SignatureValues(tx *Transaction, sig []byte) (R, S, V *big.Int, err error)
WithSignature returns a new transaction with the given signature. This signature needs to be in the [R || S || V] format where V is 0 or 1.
type TimedChainReward ¶
type TimedChainReward struct { St uint64 Number uint64 Reward *ChainReward }
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func NewContractCreation ¶
func NewTransaction ¶
func NewTransaction_Payment ¶
func SignTx ¶
func SignTx(tx *Transaction, s Signer, prv *ecdsa.PrivateKey) (*Transaction, error)
SignTx signs the transaction using the given signer and private key
func SignTx_Payment ¶
func SignTx_Payment(tx *Transaction, s Signer, prv *ecdsa.PrivateKey) (*Transaction, error)
func (*Transaction) AmountCost ¶
func (tx *Transaction) AmountCost() *big.Int
AmountCost returns amount+Fee.
func (*Transaction) AsMessage ¶
func (tx *Transaction) AsMessage(s Signer) (Message, error)
AsMessage returns the transaction as a core.Message.
AsMessage requires a signer to derive the sender.
XXX Rename message to something less arbitrary?
func (*Transaction) ChainId ¶
func (tx *Transaction) ChainId() *big.Int
ChainId returns which chain id this transaction was signed for (if at all)
func (*Transaction) CheckNonce ¶
func (tx *Transaction) CheckNonce() bool
func (*Transaction) ConvertRawTransaction ¶
func (tx *Transaction) ConvertRawTransaction() *RawTransaction
func (*Transaction) Cost ¶
func (tx *Transaction) Cost() *big.Int
Cost returns amount + gasprice * gaslimit.
func (*Transaction) Data ¶
func (tx *Transaction) Data() []byte
func (*Transaction) DecodeRLP ¶
func (tx *Transaction) DecodeRLP(s *rlp.Stream) error
DecodeRLP implements rlp.Decoder
func (*Transaction) EncodeRLP ¶
func (tx *Transaction) EncodeRLP(w io.Writer) error
EncodeRLP implements rlp.Encoder
func (*Transaction) Fee ¶
func (tx *Transaction) Fee() *big.Int
func (*Transaction) Gas ¶
func (tx *Transaction) Gas() uint64
func (*Transaction) GasCost ¶
func (tx *Transaction) GasCost() *big.Int
GasCost returns gasprice * gaslimit.
func (*Transaction) GasPrice ¶
func (tx *Transaction) GasPrice() *big.Int
func (*Transaction) Hash ¶
func (tx *Transaction) Hash() common.Hash
Hash hashes the RLP encoding of tx. It uniquely identifies the transaction.
func (*Transaction) Info ¶
func (tx *Transaction) Info() string
func (*Transaction) MarshalJSON ¶
func (tx *Transaction) MarshalJSON() ([]byte, error)
MarshalJSON encodes the web3 RPC transaction format.
func (*Transaction) Nonce ¶
func (tx *Transaction) Nonce() uint64
func (*Transaction) Payer ¶
func (tx *Transaction) Payer() *common.Address
func (*Transaction) Protected ¶
func (tx *Transaction) Protected() bool
Protected returns whether the transaction is protected from replay protection.
func (*Transaction) Protected_Payment ¶
func (tx *Transaction) Protected_Payment() bool
func (*Transaction) RawSignatureValues ¶
func (*Transaction) Size ¶
func (tx *Transaction) Size() common.StorageSize
Size returns the true RLP encoded storage size of the transaction, either by encoding and returning it, or returning a previsouly cached value.
func (*Transaction) To ¶
func (tx *Transaction) To() *common.Address
To returns the recipient address of the transaction. It returns nil if the transaction is a contract creation.
func (*Transaction) TrueRawSignatureValues ¶
func (*Transaction) UnmarshalJSON ¶
func (tx *Transaction) UnmarshalJSON(input []byte) error
UnmarshalJSON decodes the web3 RPC transaction format.
func (*Transaction) Value ¶
func (tx *Transaction) Value() *big.Int
func (*Transaction) WithSignature ¶
func (tx *Transaction) WithSignature(signer Signer, sig []byte) (*Transaction, error)
WithSignature returns a new transaction with the given signature. This signature needs to be formatted as described in the yellow paper (v+27).
func (*Transaction) WithSignature_Payment ¶
func (tx *Transaction) WithSignature_Payment(signer Signer, sig []byte) (*Transaction, error)
type Transactions ¶
type Transactions []*Transaction
Transactions is a Transaction slice type for basic sorting.
func TxDifference ¶
func TxDifference(a, b Transactions) (keep Transactions)
TxDifference returns a new set t which is the difference between a to b.
func (Transactions) GetRlp ¶
func (s Transactions) GetRlp(i int) []byte
GetRlp implements Rlpable and returns the i'th element of s in rlp.
func (Transactions) Swap ¶
func (s Transactions) Swap(i, j int)
Swap swaps the i'th and the j'th element in s.
type TransactionsByPriceAndNonce ¶
type TransactionsByPriceAndNonce struct {
// contains filtered or unexported fields
}
TransactionsByPriceAndNonce represents a set of transactions that can return transactions in a profit-maximizing sorted order, while supporting removing entire batches of transactions for non-executable accounts.
func NewTransactionsByPriceAndNonce ¶
func NewTransactionsByPriceAndNonce(signer Signer, txs map[common.Address]Transactions) *TransactionsByPriceAndNonce
NewTransactionsByPriceAndNonce creates a transaction set that can retrieve price sorted transactions in a nonce-honouring way.
Note, the input map is reowned so the caller should not interact any more with if after providing it to the constructor.
func (*TransactionsByPriceAndNonce) Peek ¶
func (t *TransactionsByPriceAndNonce) Peek() *Transaction
Peek returns the next transaction by price.
func (*TransactionsByPriceAndNonce) Pop ¶
func (t *TransactionsByPriceAndNonce) Pop()
Pop removes the best transaction, *not* replacing it with the next one from the same account. This should be used when a transaction cannot be executed and hence all subsequent ones should be discarded from the same account.
func (*TransactionsByPriceAndNonce) Shift ¶
func (t *TransactionsByPriceAndNonce) Shift()
Shift replaces the current best head with the next one from the same account.
type TransportCommitteeNode ¶
func (*TransportCommitteeNode) ConvertTransportToCommitteeNode ¶
func (tcn *TransportCommitteeNode) ConvertTransportToCommitteeNode(pubKey *ecdsa.PublicKey) *CommitteeNode
type TxByNonce ¶
type TxByNonce Transactions
TxByNonce implements the sort interface to allow sorting a list of transactions by their nonces. This is usually only useful for sorting transactions from a single account, otherwise a nonce comparison doesn't make much sense.
type TxByPrice ¶
type TxByPrice Transactions
TxByPrice implements both the sort and the heap interface, making it useful for all at once sorting as well as individually adding and removing elements.