Documentation ¶
Overview ¶
Package blockchain generated by go-bindata.// sources: stategen.out
Index ¶
- Constants
- Variables
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func BuildTx(appState *appstate.AppState, from common.Address, to *common.Address, ...) *types.Transaction
- func ConvertToFloat(amount *big.Int) decimal.Decimal
- func ConvertToInt(amount decimal.Decimal) *big.Int
- func MustAsset(name string) []byte
- func NewTiming(conf *config.ValidationConfig) *timing
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type Blockchain
- func (chain *Blockchain) AddBlock(block *types.Block, checkState *appstate.AppState, ...) error
- func (chain *Blockchain) AddHeader(header *types.Header) error
- func (chain *Blockchain) ApplyTxOnState(appState *appstate.AppState, vm vm.VM, tx *types.Transaction, ...) (*big.Int, *types.TxReceipt, error)
- func (chain *Blockchain) AtomicSwitchToPreliminary(manifest *snapshot.Manifest) error
- func (chain *Blockchain) Config() *config.Config
- func (chain *Blockchain) EnsureIntegrity() error
- func (chain *Blockchain) GenerateEmptyBlock() *types.Block
- func (chain *Blockchain) GenerateGenesis(network types.Network) (*types.Block, error)
- func (chain *Blockchain) GenesisInfo() *types.GenesisInfo
- func (chain *Blockchain) GetBlock(hash common.Hash) *types.Block
- func (chain *Blockchain) GetBlockByHeight(height uint64) *types.Block
- func (chain *Blockchain) GetBlockHeaderByHeight(height uint64) *types.Header
- func (chain *Blockchain) GetBlockWithRetry(hash common.Hash) *types.Block
- func (chain *Blockchain) GetCertificate(hash common.Hash) *types.BlockCert
- func (chain *Blockchain) GetCommitteeSize(vc *validators.ValidatorsCache, final bool) int
- func (chain *Blockchain) GetCommitteeVotesThreshold(vc *validators.ValidatorsCache, final bool) int
- func (chain *Blockchain) GetGasCost(appState *appstate.AppState, gasUsed uint64) *big.Int
- func (chain *Blockchain) GetHead() *types.Header
- func (chain *Blockchain) GetIdentityDiff(height uint64) *state.IdentityStateDiff
- func (chain *Blockchain) GetProposerSortition() (bool, []byte)
- func (chain *Blockchain) GetReceipt(hash common.Hash) *types.TxReceipt
- func (chain *Blockchain) GetTopBlockHashes(count int) []common.Hash
- func (chain *Blockchain) GetTx(hash common.Hash) (*types.Transaction, *types.TransactionIndex)
- func (chain *Blockchain) GetTxIndex(hash common.Hash) *types.TransactionIndex
- func (chain *Blockchain) Indexer() *indexer
- func (chain *Blockchain) InitializeChain() error
- func (chain *Blockchain) IsPermanentCert(header *types.Header) bool
- func (chain *Blockchain) Network() types.Network
- func (chain *Blockchain) ProposeBlock(proof []byte) *types.BlockProposal
- func (chain *Blockchain) ProvideApplyNewEpochFunc(...)
- func (chain *Blockchain) ReadBlockForForkedPeer(blocks []common.Hash) []types.BlockBundle
- func (chain *Blockchain) ReadEvents(contract common.Address) []*types.SavedEvent
- func (chain *Blockchain) ReadPreliminaryConsensusVersion() uint32
- func (chain *Blockchain) ReadPreliminaryHead() *types.Header
- func (chain *Blockchain) ReadSnapshotManifest() *snapshot.Manifest
- func (chain *Blockchain) ReadTotalBurntCoins() []*types.BurntCoins
- func (chain *Blockchain) ReadTxs(address common.Address, count int, token []byte) ([]*types.SavedTransaction, []byte)
- func (chain *Blockchain) RemovePreliminaryConsensusVersion()
- func (chain *Blockchain) RemovePreliminaryHead(batch dbm.Batch)
- func (chain *Blockchain) RemovePreliminaryIntermediateGenesis()
- func (chain *Blockchain) ResetTo(height uint64) error
- func (chain *Blockchain) Round() uint64
- func (chain *Blockchain) StartSync()
- func (chain *Blockchain) StopSync()
- func (chain *Blockchain) ValidateBlock(block *types.Block, checkState *appstate.AppState) error
- func (chain *Blockchain) ValidateBlockCert(prevBlock *types.Header, block *types.Header, cert *types.BlockCert, ...) (err error)
- func (chain *Blockchain) ValidateBlockCertOnHead(block *types.Header, cert *types.BlockCert) error
- func (chain *Blockchain) ValidateHeader(header, prevBlock *types.Header) error
- func (chain *Blockchain) ValidateProposerProof(proof []byte, pubKeyData []byte) error
- func (chain *Blockchain) ValidateSubChain(startHeight uint64, blocks []types.BlockBundle) error
- func (chain *Blockchain) WriteCertificate(hash common.Hash, cert *types.BlockCert, persistent bool)
- func (chain *Blockchain) WriteFinalConsensus(hash common.Hash)
- func (chain *Blockchain) WriteIdentityStateDiff(height uint64, diff *state.IdentityStateDiff)
- func (chain *Blockchain) WritePreliminaryConsensusVersion(ver uint32)
- func (chain *Blockchain) WritePreliminaryIntermediateGenesis(height uint64)
- func (chain *Blockchain) WriteTxIndex(hash common.Hash, txs types.Transactions)
- func (chain *Blockchain) WriteTxReceipts(cid []byte, receipts types.TxReceipts)
- type OfflineDetector
- func (dt *OfflineDetector) GetActivityMap() map[common.Address]time.Time
- func (dt *OfflineDetector) ProcessVote(vote *types.Vote)
- func (dt *OfflineDetector) ProposeOffline(head *types.Header) (*common.Address, types.BlockFlag)
- func (dt *OfflineDetector) Start(head *types.Header)
- func (dt *OfflineDetector) ValidateBlock(head *types.Header, block *types.Block) error
- func (dt *OfflineDetector) VoteForOffline(block *types.Block) bool
- type TestBlockchain
- func NewCustomTestBlockchain(blocksCount int, emptyBlocksCount int, key *ecdsa.PrivateKey) (*TestBlockchain, *appstate.AppState)
- func NewCustomTestBlockchainWithConfig(blocksCount int, emptyBlocksCount int, key *ecdsa.PrivateKey, ...) (*TestBlockchain, *appstate.AppState)
- func NewTestBlockchain(withIdentity bool, alloc map[common.Address]config.GenesisAllocation) (*TestBlockchain, *appstate.AppState, *mempool.TxPool, *ecdsa.PrivateKey)
- func NewTestBlockchainWithBlocks(blocksCount int, emptyBlocksCount int) (*TestBlockchain, *appstate.AppState)
- func NewTestBlockchainWithConfig(withIdentity bool, conf *config.ConsensusConf, ...) (*TestBlockchain, *appstate.AppState, *mempool.TxPool, *ecdsa.PrivateKey)
Constants ¶
const ( Mainnet types.Network = 0x0 Testnet types.Network = 0x1 )
const ( ProposerRole uint8 = 0x1 EmptyBlockTimeIncrement = time.Second * 20 MaxFutureBlockOffset = time.Minute * 2 MinBlockDelay = time.Second * 10 )
const (
OfflineVotesCacheLength = 10
)
Variables ¶
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶ added in v0.20.0
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func MustAsset ¶ added in v0.20.0
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func NewTiming ¶
func NewTiming(conf *config.ValidationConfig) *timing
func RestoreAsset ¶ added in v0.20.0
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶ added in v0.20.0
RestoreAssets restores an asset under the given directory recursively
Types ¶
type Blockchain ¶
type Blockchain struct { Head *types.Header PreliminaryHead *types.Header // contains filtered or unexported fields }
func NewBlockchain ¶
func NewBlockchain(config *config.Config, db dbm.DB, txpool *mempool.TxPool, appState *appstate.AppState, ipfs ipfs.Proxy, secStore *secstore.SecStore, bus eventbus.Bus, offlineDetector *OfflineDetector, keyStore *keystore.KeyStore, subManager *subscriptions.Manager, upgrader *upgrade.Upgrader) *Blockchain
func (*Blockchain) AddBlock ¶
func (chain *Blockchain) AddBlock(block *types.Block, checkState *appstate.AppState, statsCollector collector.StatsCollector) error
func (*Blockchain) ApplyTxOnState ¶
func (chain *Blockchain) ApplyTxOnState(appState *appstate.AppState, vm vm.VM, tx *types.Transaction, statsCollector collector.StatsCollector) (*big.Int, *types.TxReceipt, error)
func (*Blockchain) AtomicSwitchToPreliminary ¶
func (chain *Blockchain) AtomicSwitchToPreliminary(manifest *snapshot.Manifest) error
func (*Blockchain) Config ¶
func (chain *Blockchain) Config() *config.Config
func (*Blockchain) EnsureIntegrity ¶
func (chain *Blockchain) EnsureIntegrity() error
func (*Blockchain) GenerateEmptyBlock ¶
func (chain *Blockchain) GenerateEmptyBlock() *types.Block
func (*Blockchain) GenerateGenesis ¶
func (*Blockchain) GenesisInfo ¶ added in v0.23.0
func (chain *Blockchain) GenesisInfo() *types.GenesisInfo
func (*Blockchain) GetBlockByHeight ¶
func (chain *Blockchain) GetBlockByHeight(height uint64) *types.Block
func (*Blockchain) GetBlockHeaderByHeight ¶
func (chain *Blockchain) GetBlockHeaderByHeight(height uint64) *types.Header
func (*Blockchain) GetBlockWithRetry ¶
func (chain *Blockchain) GetBlockWithRetry(hash common.Hash) *types.Block
func (*Blockchain) GetCertificate ¶
func (chain *Blockchain) GetCertificate(hash common.Hash) *types.BlockCert
func (*Blockchain) GetCommitteeSize ¶
func (chain *Blockchain) GetCommitteeSize(vc *validators.ValidatorsCache, final bool) int
func (*Blockchain) GetCommitteeVotesThreshold ¶
func (chain *Blockchain) GetCommitteeVotesThreshold(vc *validators.ValidatorsCache, final bool) int
func (*Blockchain) GetGasCost ¶ added in v0.22.0
func (*Blockchain) GetHead ¶
func (chain *Blockchain) GetHead() *types.Header
func (*Blockchain) GetIdentityDiff ¶
func (chain *Blockchain) GetIdentityDiff(height uint64) *state.IdentityStateDiff
func (*Blockchain) GetProposerSortition ¶
func (chain *Blockchain) GetProposerSortition() (bool, []byte)
func (*Blockchain) GetReceipt ¶ added in v0.22.0
func (chain *Blockchain) GetReceipt(hash common.Hash) *types.TxReceipt
func (*Blockchain) GetTopBlockHashes ¶
func (chain *Blockchain) GetTopBlockHashes(count int) []common.Hash
func (*Blockchain) GetTx ¶
func (chain *Blockchain) GetTx(hash common.Hash) (*types.Transaction, *types.TransactionIndex)
func (*Blockchain) GetTxIndex ¶
func (chain *Blockchain) GetTxIndex(hash common.Hash) *types.TransactionIndex
func (*Blockchain) Indexer ¶ added in v0.19.5
func (chain *Blockchain) Indexer() *indexer
func (*Blockchain) InitializeChain ¶
func (chain *Blockchain) InitializeChain() error
func (*Blockchain) IsPermanentCert ¶
func (chain *Blockchain) IsPermanentCert(header *types.Header) bool
func (*Blockchain) Network ¶
func (chain *Blockchain) Network() types.Network
func (*Blockchain) ProposeBlock ¶
func (chain *Blockchain) ProposeBlock(proof []byte) *types.BlockProposal
func (*Blockchain) ProvideApplyNewEpochFunc ¶
func (chain *Blockchain) ProvideApplyNewEpochFunc(fn func(height uint64, appState *appstate.AppState, collector collector.StatsCollector) (int, *types.ValidationResults, bool))
func (*Blockchain) ReadBlockForForkedPeer ¶
func (chain *Blockchain) ReadBlockForForkedPeer(blocks []common.Hash) []types.BlockBundle
func (*Blockchain) ReadEvents ¶ added in v0.22.0
func (chain *Blockchain) ReadEvents(contract common.Address) []*types.SavedEvent
func (*Blockchain) ReadPreliminaryConsensusVersion ¶ added in v0.23.0
func (chain *Blockchain) ReadPreliminaryConsensusVersion() uint32
func (*Blockchain) ReadPreliminaryHead ¶
func (chain *Blockchain) ReadPreliminaryHead() *types.Header
func (*Blockchain) ReadSnapshotManifest ¶
func (chain *Blockchain) ReadSnapshotManifest() *snapshot.Manifest
func (*Blockchain) ReadTotalBurntCoins ¶
func (chain *Blockchain) ReadTotalBurntCoins() []*types.BurntCoins
func (*Blockchain) ReadTxs ¶
func (chain *Blockchain) ReadTxs(address common.Address, count int, token []byte) ([]*types.SavedTransaction, []byte)
func (*Blockchain) RemovePreliminaryConsensusVersion ¶ added in v0.23.0
func (chain *Blockchain) RemovePreliminaryConsensusVersion()
func (*Blockchain) RemovePreliminaryHead ¶
func (chain *Blockchain) RemovePreliminaryHead(batch dbm.Batch)
func (*Blockchain) RemovePreliminaryIntermediateGenesis ¶ added in v0.23.0
func (chain *Blockchain) RemovePreliminaryIntermediateGenesis()
func (*Blockchain) ResetTo ¶
func (chain *Blockchain) ResetTo(height uint64) error
func (*Blockchain) Round ¶
func (chain *Blockchain) Round() uint64
func (*Blockchain) StartSync ¶
func (chain *Blockchain) StartSync()
func (*Blockchain) StopSync ¶
func (chain *Blockchain) StopSync()
func (*Blockchain) ValidateBlock ¶
func (*Blockchain) ValidateBlockCert ¶
func (chain *Blockchain) ValidateBlockCert(prevBlock *types.Header, block *types.Header, cert *types.BlockCert, validatorsCache *validators.ValidatorsCache) (err error)
func (*Blockchain) ValidateBlockCertOnHead ¶
func (*Blockchain) ValidateHeader ¶
func (chain *Blockchain) ValidateHeader(header, prevBlock *types.Header) error
func (*Blockchain) ValidateProposerProof ¶
func (chain *Blockchain) ValidateProposerProof(proof []byte, pubKeyData []byte) error
func (*Blockchain) ValidateSubChain ¶
func (chain *Blockchain) ValidateSubChain(startHeight uint64, blocks []types.BlockBundle) error
func (*Blockchain) WriteCertificate ¶
func (*Blockchain) WriteFinalConsensus ¶
func (chain *Blockchain) WriteFinalConsensus(hash common.Hash)
func (*Blockchain) WriteIdentityStateDiff ¶
func (chain *Blockchain) WriteIdentityStateDiff(height uint64, diff *state.IdentityStateDiff)
func (*Blockchain) WritePreliminaryConsensusVersion ¶ added in v0.23.0
func (chain *Blockchain) WritePreliminaryConsensusVersion(ver uint32)
func (*Blockchain) WritePreliminaryIntermediateGenesis ¶ added in v0.23.0
func (chain *Blockchain) WritePreliminaryIntermediateGenesis(height uint64)
func (*Blockchain) WriteTxIndex ¶
func (chain *Blockchain) WriteTxIndex(hash common.Hash, txs types.Transactions)
func (*Blockchain) WriteTxReceipts ¶ added in v0.22.0
func (chain *Blockchain) WriteTxReceipts(cid []byte, receipts types.TxReceipts)
type OfflineDetector ¶
type OfflineDetector struct {
// contains filtered or unexported fields
}
func NewOfflineDetector ¶
func (*OfflineDetector) GetActivityMap ¶
func (dt *OfflineDetector) GetActivityMap() map[common.Address]time.Time
func (*OfflineDetector) ProcessVote ¶
func (dt *OfflineDetector) ProcessVote(vote *types.Vote)
func (*OfflineDetector) ProposeOffline ¶
func (*OfflineDetector) Start ¶
func (dt *OfflineDetector) Start(head *types.Header)
func (*OfflineDetector) ValidateBlock ¶
func (*OfflineDetector) VoteForOffline ¶
func (dt *OfflineDetector) VoteForOffline(block *types.Block) bool
type TestBlockchain ¶
type TestBlockchain struct { *Blockchain // contains filtered or unexported fields }
func NewCustomTestBlockchain ¶
func NewCustomTestBlockchain(blocksCount int, emptyBlocksCount int, key *ecdsa.PrivateKey) (*TestBlockchain, *appstate.AppState)
func NewCustomTestBlockchainWithConfig ¶
func NewCustomTestBlockchainWithConfig(blocksCount int, emptyBlocksCount int, key *ecdsa.PrivateKey, cfg *config.Config) (*TestBlockchain, *appstate.AppState)
func NewTestBlockchain ¶
func NewTestBlockchain(withIdentity bool, alloc map[common.Address]config.GenesisAllocation) (*TestBlockchain, *appstate.AppState, *mempool.TxPool, *ecdsa.PrivateKey)
func NewTestBlockchainWithBlocks ¶
func NewTestBlockchainWithBlocks(blocksCount int, emptyBlocksCount int) (*TestBlockchain, *appstate.AppState)
func NewTestBlockchainWithConfig ¶
func NewTestBlockchainWithConfig(withIdentity bool, conf *config.ConsensusConf, valConf *config.ValidationConfig, alloc map[common.Address]config.GenesisAllocation, queueSlots int, executableSlots int, executableLimit int, queueLimit int) (*TestBlockchain, *appstate.AppState, *mempool.TxPool, *ecdsa.PrivateKey)
func (*TestBlockchain) Copy ¶
func (chain *TestBlockchain) Copy() (*TestBlockchain, *appstate.AppState)
func (*TestBlockchain) GenerateBlocks ¶
func (chain *TestBlockchain) GenerateBlocks(count int) *TestBlockchain
func (*TestBlockchain) GenerateEmptyBlocks ¶
func (chain *TestBlockchain) GenerateEmptyBlocks(count int) *TestBlockchain