Documentation
¶
Index ¶
- Variables
- func NewTxPool(chainconfig chain_config.ChainConfig, chain blockChain) *tx_pool.TxPool
- type Account
- type AccountFactory
- type Accounts
- type BftChainState
- type BftCluster
- func (bc *BftCluster) NewProposal(x int, round uint64, block model2.AbstractBlock) (p []*model.Proposal)
- func (bc *BftCluster) NewRoundMsg(x int, h, round uint64) (r []*model.NewRoundMsg)
- func (bc *BftCluster) NewVote(x int, round uint64, vt model2.VoteMsgType, block model2.AbstractBlock) (p []*model2.VoteMsg)
- func (bc *BftCluster) StatesIter(cb func(*state_machine.BftState))
- type BlockBuilder
- func (builder *BlockBuilder) Build() model.AbstractBlock
- func (builder *BlockBuilder) BuildFuture() model.AbstractBlock
- func (builder *BlockBuilder) BuildSpecialBlock() model.AbstractBlock
- func (builder *BlockBuilder) ClearInvalidTxList()
- func (builder *BlockBuilder) SetMinerPk(pk *ecdsa.PrivateKey)
- func (builder *BlockBuilder) SetPreBlock(block model.AbstractBlock)
- func (builder *BlockBuilder) SetVerifivations(votes []model.AbstractVerification)
- type Chain
- type ChainHelper
- type FakeBlockForBft
- func (fb *FakeBlockForBft) Body() model2.AbstractBody
- func (fb *FakeBlockForBft) CoinBase() *big.Int
- func (fb *FakeBlockForBft) CoinBaseAddress() common.Address
- func (fb *FakeBlockForBft) Difficulty() common.Difficulty
- func (fb *FakeBlockForBft) EncodeRlpToBytes() ([]byte, error)
- func (fb *FakeBlockForBft) FormatForRpc() interface{}
- func (fb *FakeBlockForBft) GetAbsTransactions() []model2.AbstractTransaction
- func (fb *FakeBlockForBft) GetBlockTxsBloom() *iblt.Bloom
- func (fb *FakeBlockForBft) GetBloom() iblt.Bloom
- func (fb *FakeBlockForBft) GetEiBloomBlockData(reqEstimator *iblt.HybridEstimator) *model2.BloomBlockData
- func (fb *FakeBlockForBft) GetInterLinkRoot() (root common.Hash)
- func (fb *FakeBlockForBft) GetInterlinks() model2.InterLink
- func (fb *FakeBlockForBft) GetRegisterRoot() common.Hash
- func (fb *FakeBlockForBft) GetTransactionFees() *big.Int
- func (fb *FakeBlockForBft) GetTransactions() []*model2.Transaction
- func (fb *FakeBlockForBft) GetVerifications() []model2.AbstractVerification
- func (fb *FakeBlockForBft) Hash() common.Hash
- func (fb *FakeBlockForBft) Header() model2.AbstractHeader
- func (fb *FakeBlockForBft) IsSpecial() bool
- func (fb *FakeBlockForBft) Nonce() common.BlockNonce
- func (fb *FakeBlockForBft) Number() uint64
- func (fb *FakeBlockForBft) PreHash() common.Hash
- func (fb *FakeBlockForBft) RefreshHashCache() common.Hash
- func (fb *FakeBlockForBft) Seed() common.Hash
- func (fb *FakeBlockForBft) SetInterLinkRoot(root common.Hash)
- func (fb *FakeBlockForBft) SetInterLinks(inter model2.InterLink)
- func (fb *FakeBlockForBft) SetNonce(nonce common.BlockNonce)
- func (fb *FakeBlockForBft) SetRegisterRoot(root common.Hash)
- func (fb *FakeBlockForBft) SetStateRoot(root common.Hash)
- func (fb *FakeBlockForBft) SetVerifications(vs []model2.AbstractVerification)
- func (fb *FakeBlockForBft) StateRoot() common.Hash
- func (fb *FakeBlockForBft) Timestamp() *big.Int
- func (fb *FakeBlockForBft) TxCount() int
- func (fb *FakeBlockForBft) TxIterator(cb func(int, model2.AbstractTransaction) error) error
- func (fb *FakeBlockForBft) TxRoot() common.Hash
- func (fb *FakeBlockForBft) VerificationRoot() common.Hash
- func (fb *FakeBlockForBft) VersIterator(func(int, model2.AbstractVerification, model2.AbstractBlock) error) error
- func (fb *FakeBlockForBft) Version() uint64
- type GenesisEnv
- type StateHelper
- type StateReader
- type StateWriter
- type TxBuilder
- type VerBuilder
- type VerifierHelper
Constants ¶
This section is empty.
Variables ¶
View Source
var AccFactory = &AccountFactory{}
Functions ¶
Types ¶
type Account ¶
type Account struct {
Pk *ecdsa.PrivateKey
// contains filtered or unexported fields
}
func ChangeVerifierAddress ¶
func NewAccount ¶
func NewAccount(pk *ecdsa.PrivateKey, address common.Address) *Account
type AccountFactory ¶
type AccountFactory struct{}
get or gen account
func (*AccountFactory) GenAccounts ¶
func (acc *AccountFactory) GenAccounts(x int) (r []Account)
gen x accounts
func (*AccountFactory) GetAccount ¶
func (acc *AccountFactory) GetAccount(index int) Account
get default account(have certain address)
type BftChainState ¶
type BftChainState interface {
Chain
SaveBftBlock(block model.AbstractBlock, seenCommits []model.AbstractVerification) error
}
type BftCluster ¶
type BftCluster struct {
BftStates []*state_machine.BftState
Verifiers []Account
}
func NewBftCluster ¶
func NewBftCluster(verifiers []Account) *BftCluster
func (*BftCluster) NewProposal ¶
func (bc *BftCluster) NewProposal(x int, round uint64, block model2.AbstractBlock) (p []*model.Proposal)
func (*BftCluster) NewRoundMsg ¶
func (bc *BftCluster) NewRoundMsg(x int, h, round uint64) (r []*model.NewRoundMsg)
func (*BftCluster) NewVote ¶
func (bc *BftCluster) NewVote(x int, round uint64, vt model2.VoteMsgType, block model2.AbstractBlock) (p []*model2.VoteMsg)
func (*BftCluster) StatesIter ¶
func (bc *BftCluster) StatesIter(cb func(*state_machine.BftState))
type BlockBuilder ¶
type BlockBuilder struct {
ChainState Chain
PreBlock model.AbstractBlock
Txs []*model.Transaction
// commit list
Vers []model.AbstractVerification
MinerPk *ecdsa.PrivateKey
InvalidTxList []model.AbstractTransaction
}
func (*BlockBuilder) Build ¶
func (builder *BlockBuilder) Build() model.AbstractBlock
build the wait-pack block
func (*BlockBuilder) BuildFuture ¶
func (builder *BlockBuilder) BuildFuture() model.AbstractBlock
build future block
func (*BlockBuilder) BuildSpecialBlock ¶
func (builder *BlockBuilder) BuildSpecialBlock() model.AbstractBlock
build special block
func (*BlockBuilder) ClearInvalidTxList ¶
func (builder *BlockBuilder) ClearInvalidTxList()
func (*BlockBuilder) SetMinerPk ¶
func (builder *BlockBuilder) SetMinerPk(pk *ecdsa.PrivateKey)
func (*BlockBuilder) SetPreBlock ¶
func (builder *BlockBuilder) SetPreBlock(block model.AbstractBlock)
func (*BlockBuilder) SetVerifivations ¶
func (builder *BlockBuilder) SetVerifivations(votes []model.AbstractVerification)
type Chain ¶
type Chain interface {
StateReader
StateWriter
VerifierHelper
StateHelper
ChainHelper
}
type ChainHelper ¶
type FakeBlockForBft ¶
type FakeBlockForBft struct {
Num uint64
PHash common.Hash
// contains filtered or unexported fields
}
func (*FakeBlockForBft) Body ¶
func (fb *FakeBlockForBft) Body() model2.AbstractBody
func (*FakeBlockForBft) CoinBase ¶
func (fb *FakeBlockForBft) CoinBase() *big.Int
func (*FakeBlockForBft) CoinBaseAddress ¶
func (fb *FakeBlockForBft) CoinBaseAddress() common.Address
func (*FakeBlockForBft) Difficulty ¶
func (fb *FakeBlockForBft) Difficulty() common.Difficulty
func (*FakeBlockForBft) EncodeRlpToBytes ¶
func (fb *FakeBlockForBft) EncodeRlpToBytes() ([]byte, error)
func (*FakeBlockForBft) FormatForRpc ¶
func (fb *FakeBlockForBft) FormatForRpc() interface{}
func (*FakeBlockForBft) GetAbsTransactions ¶
func (fb *FakeBlockForBft) GetAbsTransactions() []model2.AbstractTransaction
func (*FakeBlockForBft) GetBlockTxsBloom ¶
func (fb *FakeBlockForBft) GetBlockTxsBloom() *iblt.Bloom
func (*FakeBlockForBft) GetBloom ¶
func (fb *FakeBlockForBft) GetBloom() iblt.Bloom
func (*FakeBlockForBft) GetEiBloomBlockData ¶
func (fb *FakeBlockForBft) GetEiBloomBlockData(reqEstimator *iblt.HybridEstimator) *model2.BloomBlockData
func (*FakeBlockForBft) GetInterLinkRoot ¶
func (fb *FakeBlockForBft) GetInterLinkRoot() (root common.Hash)
func (*FakeBlockForBft) GetInterlinks ¶
func (fb *FakeBlockForBft) GetInterlinks() model2.InterLink
func (*FakeBlockForBft) GetRegisterRoot ¶
func (fb *FakeBlockForBft) GetRegisterRoot() common.Hash
func (*FakeBlockForBft) GetTransactionFees ¶
func (fb *FakeBlockForBft) GetTransactionFees() *big.Int
func (*FakeBlockForBft) GetTransactions ¶
func (fb *FakeBlockForBft) GetTransactions() []*model2.Transaction
func (*FakeBlockForBft) GetVerifications ¶
func (fb *FakeBlockForBft) GetVerifications() []model2.AbstractVerification
func (*FakeBlockForBft) Hash ¶
func (fb *FakeBlockForBft) Hash() common.Hash
func (*FakeBlockForBft) Header ¶
func (fb *FakeBlockForBft) Header() model2.AbstractHeader
func (*FakeBlockForBft) IsSpecial ¶
func (fb *FakeBlockForBft) IsSpecial() bool
func (*FakeBlockForBft) Nonce ¶
func (fb *FakeBlockForBft) Nonce() common.BlockNonce
func (*FakeBlockForBft) Number ¶
func (fb *FakeBlockForBft) Number() uint64
func (*FakeBlockForBft) PreHash ¶
func (fb *FakeBlockForBft) PreHash() common.Hash
func (*FakeBlockForBft) RefreshHashCache ¶
func (fb *FakeBlockForBft) RefreshHashCache() common.Hash
func (*FakeBlockForBft) Seed ¶
func (fb *FakeBlockForBft) Seed() common.Hash
func (*FakeBlockForBft) SetInterLinkRoot ¶
func (fb *FakeBlockForBft) SetInterLinkRoot(root common.Hash)
func (*FakeBlockForBft) SetInterLinks ¶
func (fb *FakeBlockForBft) SetInterLinks(inter model2.InterLink)
func (*FakeBlockForBft) SetNonce ¶
func (fb *FakeBlockForBft) SetNonce(nonce common.BlockNonce)
func (*FakeBlockForBft) SetRegisterRoot ¶
func (fb *FakeBlockForBft) SetRegisterRoot(root common.Hash)
func (*FakeBlockForBft) SetStateRoot ¶
func (fb *FakeBlockForBft) SetStateRoot(root common.Hash)
func (*FakeBlockForBft) SetVerifications ¶
func (fb *FakeBlockForBft) SetVerifications(vs []model2.AbstractVerification)
func (*FakeBlockForBft) StateRoot ¶
func (fb *FakeBlockForBft) StateRoot() common.Hash
func (*FakeBlockForBft) Timestamp ¶
func (fb *FakeBlockForBft) Timestamp() *big.Int
func (*FakeBlockForBft) TxCount ¶
func (fb *FakeBlockForBft) TxCount() int
func (*FakeBlockForBft) TxIterator ¶
func (fb *FakeBlockForBft) TxIterator(cb func(int, model2.AbstractTransaction) error) error
func (*FakeBlockForBft) TxRoot ¶
func (fb *FakeBlockForBft) TxRoot() common.Hash
func (*FakeBlockForBft) VerificationRoot ¶
func (fb *FakeBlockForBft) VerificationRoot() common.Hash
func (*FakeBlockForBft) VersIterator ¶
func (fb *FakeBlockForBft) VersIterator(func(int, model2.AbstractVerification, model2.AbstractBlock) error) error
func (*FakeBlockForBft) Version ¶
func (fb *FakeBlockForBft) Version() uint64
type GenesisEnv ¶
type GenesisEnv struct {
// contains filtered or unexported fields
}
Initialize the default validator in which the external test calls its method to vote on the block
func NewGenesisEnv ¶
func NewGenesisEnv(chainDB chaindb.Database, stateStorage state_processor.StateStorage, accounts []Account) *GenesisEnv
func (*GenesisEnv) DefaultVerifiers ¶
func (g *GenesisEnv) DefaultVerifiers() []Account
func (*GenesisEnv) Miner ¶
func (g *GenesisEnv) Miner() Account
func (*GenesisEnv) VoteBlock ¶
func (g *GenesisEnv) VoteBlock(num int, round uint64, b model.AbstractBlock) (result []model.AbstractVerification)
num is the number of votes
type StateHelper ¶
type StateHelper interface {
GetStateStorage() state_processor.StateStorage
CurrentState() (*state_processor.AccountStateDB, error)
StateAtByBlockNumber(num uint64) (*state_processor.AccountStateDB, error)
StateAtByStateRoot(root common.Hash) (*state_processor.AccountStateDB, error)
BuildStateProcessor(preAccountStateRoot common.Hash) (*state_processor.AccountStateDB, error)
}
type StateReader ¶
type StateReader interface {
Genesis() model.AbstractBlock
CurrentBlock() model.AbstractBlock
CurrentHeader() model.AbstractHeader
GetBlock(hash common.Hash, number uint64) model.AbstractBlock
GetBlockByHash(hash common.Hash) model.AbstractBlock
GetBlockByNumber(number uint64) model.AbstractBlock
HasBlock(hash common.Hash, number uint64) bool
GetBody(hash common.Hash) model.AbstractBody
GetBodyRLP(hash common.Hash) rlp.RawValue
GetHeader(hash common.Hash, number uint64) model.AbstractHeader
GetHeaderByHash(hash common.Hash) model.AbstractHeader
GetHeaderByNumber(number uint64) model.AbstractHeader
GetHeaderRLP(hash common.Hash) rlp.RawValue
HasHeader(hash common.Hash, number uint64) bool
GetBlockNumber(hash common.Hash) *uint64
GetTransaction(txHash common.Hash) (model.AbstractTransaction, common.Hash, uint64, uint64)
BlockProcessor(root common.Hash) (*chain.BlockProcessor, error)
BlockProcessorByNumber(num uint64) (*chain.BlockProcessor, error)
}
type StateWriter ¶
type StateWriter interface {
SaveBlock(block model.AbstractBlock) error
}
type TxBuilder ¶
type TxBuilder struct {
Nonce uint64
To common.Address
Amount *big.Int
Fee *big.Int
Data []byte
Pk *ecdsa.PrivateKey
}
交易builder
func (*TxBuilder) Build ¶
func (b *TxBuilder) Build() *model.Transaction
func (*TxBuilder) BuildAbs ¶
func (b *TxBuilder) BuildAbs() model.AbstractTransaction
type VerBuilder ¶
type VerBuilder struct {
Round uint64
VoteType model.VoteMsgType
Block model.AbstractBlock
Pk *ecdsa.PrivateKey
}
func (*VerBuilder) Build ¶
func (b *VerBuilder) Build() model.AbstractVerification
type VerifierHelper ¶
type VerifierHelper interface {
CurrentSeed() (common.Hash, uint64)
IsChangePoint(block model.AbstractBlock, isProcessPackageBlock bool) bool
GetLastChangePoint(block model.AbstractBlock) *uint64
GetSlotByNum(num uint64) *uint64
GetSlot(block model.AbstractBlock) *uint64
GetCurrVerifiers() []common.Address
GetVerifiers(round uint64) []common.Address
GetNextVerifiers() []common.Address
NumBeforeLastBySlot(slot uint64) *uint64
BuildRegisterProcessor(preRoot common.Hash) (*registerdb.RegisterDB, error)
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
call-node-rpc
|
|
|
cur-balance
command
|
|
|
start-mine
command
|
|
|
chain-test-spec
|
|
|
general
|
|
|
20190226
command
|
|
|
client
command
|
|
Click to show internal directories.
Click to hide internal directories.