Documentation ¶
Index ¶
- type Blockchain
- func (bc *Blockchain) CurrentBlockHash() crypto.Hash
- func (bc *Blockchain) CurrentHeight() uint32
- func (bc *Blockchain) GenerateBlock(txs proto.Transactions, createTime uint32) *proto.Block
- func (bc *Blockchain) GetAsset(id uint32) *state.Asset
- func (bc *Blockchain) GetBalance(addr account.Address) *balance.Balance
- func (bc *Blockchain) GetBlockchainInfo() *consensus.BlockchainInfo
- func (bc *Blockchain) GetConsenter() consensus.Consenter
- func (bc *Blockchain) GetLedger() *ledger.Ledger
- func (bc *Blockchain) GetNextBlockHash(h crypto.Hash) (crypto.Hash, error)
- func (bc *Blockchain) GetTransaction(txHash crypto.Hash) (*proto.Transaction, error)
- func (bc *Blockchain) ProcessBlock(blk *proto.Block, flag bool) bool
- func (bc *Blockchain) ProcessTransaction(tx *proto.Transaction, needNotify bool) bool
- func (bc *Blockchain) Relay(inv proto.IInventory)
- func (bc *Blockchain) Start()
- func (bc *Blockchain) StartConsensusService()
- func (bc *Blockchain) StartServices()
- func (bc *Blockchain) StartTxPoolService()
- func (bc *Blockchain) Started() bool
- func (bc *Blockchain) Stop()
- func (bc *Blockchain) Synced() bool
- func (bc *Blockchain) VerifyTxs(txs proto.Transactions) (proto.Transactions, proto.Transactions)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Blockchain ¶
type Blockchain struct {
// contains filtered or unexported fields
}
Blockchain is blockchain instance
func NewBlockchain ¶
func NewBlockchain(pm peer.IProtocolManager) *Blockchain
NewBlockchain returns a fully initialised blockchain service using input data
func (*Blockchain) CurrentBlockHash ¶
func (bc *Blockchain) CurrentBlockHash() crypto.Hash
CurrentBlockHash returns current block hash of the current block
func (*Blockchain) CurrentHeight ¶
func (bc *Blockchain) CurrentHeight() uint32
CurrentHeight returns current heigt of the current block
func (*Blockchain) GenerateBlock ¶
func (bc *Blockchain) GenerateBlock(txs proto.Transactions, createTime uint32) *proto.Block
GenerateBlock gets transactions from consensus service and generates a new block
func (*Blockchain) GetAsset ¶
func (bc *Blockchain) GetAsset(id uint32) *state.Asset
GetAsset returns asset
func (*Blockchain) GetBalance ¶
func (bc *Blockchain) GetBalance(addr account.Address) *balance.Balance
GetBalance returns balance
func (*Blockchain) GetBlockchainInfo ¶
func (bc *Blockchain) GetBlockchainInfo() *consensus.BlockchainInfo
func (*Blockchain) GetConsenter ¶
func (bc *Blockchain) GetConsenter() consensus.Consenter
func (*Blockchain) GetLedger ¶
func (bc *Blockchain) GetLedger() *ledger.Ledger
func (*Blockchain) GetNextBlockHash ¶
GetNextBlockHash returns the next block hash
func (*Blockchain) GetTransaction ¶
func (bc *Blockchain) GetTransaction(txHash crypto.Hash) (*proto.Transaction, error)
GetTransaction returns transaction in ledger first then txBool
func (*Blockchain) ProcessBlock ¶
func (bc *Blockchain) ProcessBlock(blk *proto.Block, flag bool) bool
ProcessBlock processes new block from the network,flag = true pack up block ,flag = false sync block
func (*Blockchain) ProcessTransaction ¶
func (bc *Blockchain) ProcessTransaction(tx *proto.Transaction, needNotify bool) bool
ProcessTransaction processes new transaction from the network
func (*Blockchain) Relay ¶
func (bc *Blockchain) Relay(inv proto.IInventory)
func (*Blockchain) Start ¶
func (bc *Blockchain) Start()
func (*Blockchain) StartConsensusService ¶
func (bc *Blockchain) StartConsensusService()
StartConsensusService starts consensus service
func (*Blockchain) StartServices ¶
func (bc *Blockchain) StartServices()
Start starts blockchain services
func (*Blockchain) StartTxPoolService ¶
func (bc *Blockchain) StartTxPoolService()
StartTxPool starts txpool service
func (*Blockchain) Started ¶
func (bc *Blockchain) Started() bool
func (*Blockchain) Stop ¶
func (bc *Blockchain) Stop()
func (*Blockchain) Synced ¶
func (bc *Blockchain) Synced() bool
func (*Blockchain) VerifyTxs ¶
func (bc *Blockchain) VerifyTxs(txs proto.Transactions) (proto.Transactions, proto.Transactions)
VerifyTxs verify