Documentation ¶
Index ¶
- Variables
- func SetupGenesisBlock(db protocol.ChainDB, genesis *Genesis) *types.Block
- type BlockChain
- func (bc *BlockChain) AccountManager() *account.Manager
- func (bc *BlockChain) ChainID() uint16
- func (bc *BlockChain) CurrentBlock() *types.Block
- func (bc *BlockChain) DeputyManager() *deputynode.Manager
- func (bc *BlockChain) Flags() flag.CmdFlags
- func (bc *BlockChain) Founder() common.Address
- func (bc *BlockChain) Genesis() *types.Block
- func (bc *BlockChain) GetBlockByHash(hash common.Hash) *types.Block
- func (bc *BlockChain) GetBlockByHeight(height uint32) *types.Block
- func (bc *BlockChain) GetCandidatesTop(hash common.Hash) []*store.Candidate
- func (bc *BlockChain) GetParentByHeight(height uint32, sonBlockHash common.Hash) *types.Block
- func (bc *BlockChain) HasBlock(hash common.Hash) bool
- func (bc *BlockChain) InsertBlock(block *types.Block) error
- func (bc *BlockChain) InsertConfirm(info *network.BlockConfirmData)
- func (bc *BlockChain) InsertStableConfirms(pack network.BlockConfirms)
- func (bc *BlockChain) IsInBlackList(b *types.Block) bool
- func (bc *BlockChain) MineBlock(material *consensus.BlockMaterial)
- func (bc *BlockChain) StableBlock() *types.Block
- func (bc *BlockChain) Stop()
- func (bc *BlockChain) SubscribeNewBlock(ch chan *types.Block) subscribe.Subscription
- func (bc *BlockChain) TxProcessor() *transaction.TxProcessor
- type Config
- type Genesis
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrGenesisExtraTooLong = errors.New("genesis config's extraData is longer than 256") ErrGenesisTimeTooLarge = errors.New("genesis config's time is larger than current time") ErrNoDeputyNodes = errors.New("no deputy nodes in genesis") ErrInvalidDeputyNodes = errors.New("genesis config's deputy nodes are invalid") )
View Source
var ( DefaultFounder = decodeMinerAddress("Lemo83GN72GYH2NZ8BA729Z9TCT7KQ5FC3CR6DJG") // Initial LEMO holder DefaultDeputyNodes = deputynode.DeputyNodes{ &deputynode.DeputyNode{ MinerAddress: DefaultFounder, NodeID: common.FromHex("0x5e3600755f9b512a65603b38e30885c98cbac70259c3235c9b3f42ee563b480edea351ba0ff5748a638fe0aeff5d845bf37a3b437831871b48fd32f33cd9a3c0"), Rank: 0, Votes: new(big.Int).SetInt64(5), }, &deputynode.DeputyNode{ MinerAddress: decodeMinerAddress("Lemo83JW7TBPA7P2P6AR9ZC2WCQJYRNHZ4NJD4CY"), NodeID: common.FromHex("0xddb5fc36c415799e4c0cf7046ddde04aad6de8395d777db4f46ebdf258e55ee1d698fdd6f81a950f00b78bb0ea562e4f7de38cb0adf475c5026bb885ce74afb0"), Rank: 1, Votes: new(big.Int).SetInt64(4), }, &deputynode.DeputyNode{ MinerAddress: decodeMinerAddress("Lemo842BJZ4DKCC764C63Y6A943775JH6NQ3Z33Y"), NodeID: common.FromHex("0x7739f34055d3c0808683dbd77a937f8e28f707d5b1e873bbe61f6f2d0347692f36ef736f342fb5ce4710f7e337f062cc2110d134b63a9575f78cb167bfae2f43"), Rank: 2, Votes: new(big.Int).SetInt64(3), }, &deputynode.DeputyNode{ MinerAddress: decodeMinerAddress("Lemo837QGPS3YNTYNF53CD88WA5DR3ABNA95W2DG"), NodeID: common.FromHex("0x34f0df789b46e9bc09f23d5315b951bc77bbfeda653ae6f5aab564c9b4619322fddb3b1f28d1c434250e9d4dd8f51aa8334573d7281e4d63baba913e9fa6908f"), Rank: 3, Votes: new(big.Int).SetInt64(2), }, &deputynode.DeputyNode{ MinerAddress: decodeMinerAddress("Lemo83HKZK68JQZDRGS5PWT2ZBSKR5CRADCSJB9B"), NodeID: common.FromHex("0x5b980ffb1b463fce4773a22ebf376c07c6207023b016b36ccfaba7be1cd1ab4a91737741cd43b7fcb10879e0fcf314d69fa953daec0f02be0f8f9cedb0cb3797"), Rank: 4, Votes: new(big.Int).SetInt64(1), }, } )
View Source
var ErrNoGenesis = errors.New("can't get genesis block")
Functions ¶
Types ¶
type BlockChain ¶
type BlockChain struct {
// contains filtered or unexported fields
}
func NewBlockChain ¶
func (*BlockChain) AccountManager ¶
func (bc *BlockChain) AccountManager() *account.Manager
func (*BlockChain) CurrentBlock ¶
func (bc *BlockChain) CurrentBlock() *types.Block
CurrentBlock get latest current block
func (*BlockChain) DeputyManager ¶ added in v1.2.0
func (bc *BlockChain) DeputyManager() *deputynode.Manager
func (*BlockChain) Flags ¶
func (bc *BlockChain) Flags() flag.CmdFlags
func (*BlockChain) Founder ¶ added in v1.2.0
func (bc *BlockChain) Founder() common.Address
Founder is LEMO holder in the genesis block
func (*BlockChain) GetBlockByHash ¶
func (bc *BlockChain) GetBlockByHash(hash common.Hash) *types.Block
func (*BlockChain) GetBlockByHeight ¶
func (bc *BlockChain) GetBlockByHeight(height uint32) *types.Block
func (*BlockChain) GetCandidatesTop ¶ added in v1.3.0
func (bc *BlockChain) GetCandidatesTop(hash common.Hash) []*store.Candidate
func (*BlockChain) GetParentByHeight ¶ added in v1.3.0
func (*BlockChain) HasBlock ¶
func (bc *BlockChain) HasBlock(hash common.Hash) bool
HasBlock has special block in local
func (*BlockChain) InsertBlock ¶ added in v1.3.0
func (bc *BlockChain) InsertBlock(block *types.Block) error
InsertBlock insert block of non-self to chain
func (*BlockChain) InsertConfirm ¶ added in v1.3.0
func (bc *BlockChain) InsertConfirm(info *network.BlockConfirmData)
ReceiveConfirm
func (*BlockChain) InsertStableConfirms ¶ added in v1.3.0
func (bc *BlockChain) InsertStableConfirms(pack network.BlockConfirms)
InsertStableConfirms receive confirm package from net connection. The block of these confirms has been confirmed by its son block already
func (*BlockChain) IsInBlackList ¶ added in v1.3.0
func (bc *BlockChain) IsInBlackList(b *types.Block) bool
func (*BlockChain) MineBlock ¶ added in v1.3.0
func (bc *BlockChain) MineBlock(material *consensus.BlockMaterial)
func (*BlockChain) StableBlock ¶
func (bc *BlockChain) StableBlock() *types.Block
StableBlock get latest stable block
func (*BlockChain) SubscribeNewBlock ¶ added in v1.3.0
func (bc *BlockChain) SubscribeNewBlock(ch chan *types.Block) subscribe.Subscription
SubscribeNewBlock subscribe the current block update notification
func (*BlockChain) TxProcessor ¶
func (bc *BlockChain) TxProcessor() *transaction.TxProcessor
type Genesis ¶
type Genesis struct { Time uint32 `json:"timestamp" gencodec:"required"` ExtraData []byte `json:"extraData"` GasLimit uint64 `json:"gasLimit" gencodec:"required"` Founder common.Address `json:"founder" gencodec:"required"` DeputyNodes deputynode.DeputyNodes `json:"deputyNodes" gencodec:"required"` }
func DefaultGenesisBlock ¶
func DefaultGenesisBlock() *Genesis
DefaultGenesisBlock default genesis block
func (Genesis) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*Genesis) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
Directories ¶
Path | Synopsis |
---|---|
abi
Package abi implements the Lemochain ABI (Application Binary Interface).
|
Package abi implements the Lemochain ABI (Application Binary Interface). |
runtime
Package runtime provides a basic execution model for executing EVM code.
|
Package runtime provides a basic execution model for executing EVM code. |
Click to show internal directories.
Click to hide internal directories.