Documentation ¶
Index ¶
- Constants
- Variables
- func CanTransfer(am vm.AccountManager, addr common.Address, amount *big.Int) bool
- func GetHashFn(ref *types.Header, chain ChainContext) vm.GetHashFunc
- func IntrinsicGas(data []byte, contractCreation bool) (uint64, error)
- func NewEVMContext(tx *types.Transaction, header *types.Header, txIndex uint, txHash common.Hash, ...) vm.Context
- func SetupGenesisBlock(db protocol.ChainDB, genesis *Genesis) (common.Hash, error)
- func Transfer(am vm.AccountManager, sender, recipient common.Address, amount *big.Int)
- type ApplyTxsResult
- type BlockChain
- func (bc *BlockChain) AccountManager() *account.Manager
- func (bc *BlockChain) ChainID() uint16
- func (bc *BlockChain) CurrentBlock() *types.Block
- func (bc *BlockChain) Db() db.ChainDB
- func (bc *BlockChain) Flags() flag.CmdFlags
- 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) GetConfirms(query *protocol.GetConfirmInfo) []types.SignData
- func (bc *BlockChain) HasBlock(hash common.Hash) bool
- func (bc *BlockChain) InsertChain(block *types.Block, isSynchronising bool) (err error)
- func (bc *BlockChain) ReceiveConfirm(info *protocol.BlockConfirmData) (err error)
- func (bc *BlockChain) ReceiveConfirms(pack protocol.BlockConfirms)
- func (bc *BlockChain) SetMinedBlock(block *types.Block) error
- func (bc *BlockChain) SetStableBlock(hash common.Hash, height uint32, logLess bool) error
- func (bc *BlockChain) StableBlock() *types.Block
- func (bc *BlockChain) Stop()
- func (bc *BlockChain) TxProcessor() *TxProcessor
- func (bc *BlockChain) Verify(block *types.Block) error
- type ChainContext
- type Dpovp
- type Engine
- type EngineTestForChain
- func (engine *EngineTestForChain) Finalize(header *types.Header, am *account.Manager)
- func (engine *EngineTestForChain) Seal(header *types.Header, txs []*types.Transaction, changeLog []*types.ChangeLog, ...) (*types.Block, error)
- func (engine *EngineTestForChain) VerifyHeader(block *types.Block) error
- type Genesis
- type TransactionWithTime
- type TxPool
- type TxProcessor
- func (p *TxProcessor) ApplyTxs(header *types.Header, txs types.Transactions) (*types.Header, types.Transactions, types.Transactions, error)
- func (p *TxProcessor) FillHeader(header *types.Header, txs types.Transactions, gasUsed uint64) (*types.Header, error)
- func (p *TxProcessor) Process(block *types.Block) (*types.Header, error)
- type TxsRecent
- type TxsSort
- type TxsSortByTime
Constants ¶
const MaxExtraDataLen = 256
Variables ¶
var ( ErrNoGenesis = errors.New("can't get genesis block") ErrBlockNotExist = errors.New("block not exist in local") ErrSaveBlock = errors.New("save block to db error") ErrSaveAccount = errors.New("save account error") ErrVerifyHeaderFailed = errors.New("verify block's header error") ErrVerifyBlockFailed = errors.New("verify block error") ErrInvalidConfirmInfo = errors.New("invalid confirm info") ErrInvalidSignedConfirmInfo = errors.New("invalid signed data of confirm info") ErrSetConfirmInfoToDB = errors.New("set confirm info to db error") ErrSetStableBlockToDB = errors.New("set stable block to db error") ErrStableHeightLargerThanCurrent = errors.New("stable block's height is larger than current block") )
var ( // ErrInvalidSender is returned if the transaction contains an invalid signature. ErrInvalidSender = errors.New("invalid sender") // ErrInsufficientFunds is returned if the total cost of executing a transaction // is higher than the balance of the user's account. ErrInsufficientFunds = errors.New("insufficient funds for gas * price + value") )
var ( ErrInsufficientBalanceForGas = errors.New("insufficient balance to pay for gas") ErrInvalidTxInBlock = errors.New("block contains invalid transaction") )
var DefaultDeputyNodes = deputynode.DeputyNodes{ &deputynode.DeputyNode{ MinerAddress: decodeMinerAddress("Lemo83GN72GYH2NZ8BA729Z9TCT7KQ5FC3CR6DJG"), NodeID: common.FromHex("0x5e3600755f9b512a65603b38e30885c98cbac70259c3235c9b3f42ee563b480edea351ba0ff5748a638fe0aeff5d845bf37a3b437831871b48fd32f33cd9a3c0"), IP: net.ParseIP("127.0.0.1"), Port: 7001, Rank: 0, Votes: 50000, }, &deputynode.DeputyNode{ MinerAddress: decodeMinerAddress("Lemo83JW7TBPA7P2P6AR9ZC2WCQJYRNHZ4NJD4CY"), NodeID: common.FromHex("0xddb5fc36c415799e4c0cf7046ddde04aad6de8395d777db4f46ebdf258e55ee1d698fdd6f81a950f00b78bb0ea562e4f7de38cb0adf475c5026bb885ce74afb0"), IP: net.ParseIP("127.0.0.1"), Port: 7002, Rank: 1, Votes: 40000, }, &deputynode.DeputyNode{ MinerAddress: decodeMinerAddress("Lemo842BJZ4DKCC764C63Y6A943775JH6NQ3Z33Y"), NodeID: common.FromHex("0x7739f34055d3c0808683dbd77a937f8e28f707d5b1e873bbe61f6f2d0347692f36ef736f342fb5ce4710f7e337f062cc2110d134b63a9575f78cb167bfae2f43"), IP: net.ParseIP("127.0.0.1"), Port: 7003, Rank: 2, Votes: 30000, }, &deputynode.DeputyNode{ MinerAddress: decodeMinerAddress("Lemo837QGPS3YNTYNF53CD88WA5DR3ABNA95W2DG"), NodeID: common.FromHex("0x34f0df789b46e9bc09f23d5315b951bc77bbfeda653ae6f5aab564c9b4619322fddb3b1f28d1c434250e9d4dd8f51aa8334573d7281e4d63baba913e9fa6908f"), IP: net.ParseIP("127.0.0.1"), Port: 7004, Rank: 3, Votes: 20000, }, &deputynode.DeputyNode{ MinerAddress: decodeMinerAddress("Lemo83HKZK68JQZDRGS5PWT2ZBSKR5CRADCSJB9B"), NodeID: common.FromHex("0x5b980ffb1b463fce4773a22ebf376c07c6207023b016b36ccfaba7be1cd1ab4a91737741cd43b7fcb10879e0fcf314d69fa953daec0f02be0f8f9cedb0cb3797"), IP: net.ParseIP("127.0.0.1"), Port: 7005, Rank: 4, Votes: 10000, }, }
DefaultDeputyNodes
var TransactionTimeOut = int64(10)
Functions ¶
func CanTransfer ¶
CanTransfer checks whether there are enough funds in the address' account to make a transfer. This does not take the necessary gas in to account to make the transfer valid.
func GetHashFn ¶
func GetHashFn(ref *types.Header, chain ChainContext) vm.GetHashFunc
GetHashFn returns a GetHashFunc which retrieves header hashes by number
func IntrinsicGas ¶
IntrinsicGas computes the 'intrinsic gas' for a message with the given data.
func NewEVMContext ¶
func NewEVMContext(tx *types.Transaction, header *types.Header, txIndex uint, txHash common.Hash, blockHash common.Hash, chain ChainContext) vm.Context
NewEVMContext creates a new context for use in the EVM.
func SetupGenesisBlock ¶
SetupGenesisBlock setup genesis block
Types ¶
type ApplyTxsResult ¶
type BlockChain ¶
type BlockChain struct { BroadcastConfirmInfo broadcastConfirmInfoFn // callback of broadcast confirm info BroadcastStableBlock broadcastBlockFn // callback of broadcast stable block MinedBlockFeed subscribe.Feed RecvBlockFeed subscribe.Feed StableBlockFeed subscribe.Feed // contains filtered or unexported fields }
func NewBlockChain ¶
func NewBlockChainForTest ¶
func NewBlockChainForTest() (*BlockChain, chan *types.Block, error)
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) Db ¶
func (bc *BlockChain) Db() db.ChainDB
func (*BlockChain) Flags ¶
func (bc *BlockChain) Flags() flag.CmdFlags
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) GetConfirms ¶
func (bc *BlockChain) GetConfirms(query *protocol.GetConfirmInfo) []types.SignData
GetConfirms get all confirm info of special block
func (*BlockChain) HasBlock ¶
func (bc *BlockChain) HasBlock(hash common.Hash) bool
HasBlock has special block in local
func (*BlockChain) InsertChain ¶
func (bc *BlockChain) InsertChain(block *types.Block, isSynchronising bool) (err error)
InsertChain insert block of non-self to chain
func (*BlockChain) ReceiveConfirm ¶
func (bc *BlockChain) ReceiveConfirm(info *protocol.BlockConfirmData) (err error)
ReceiveConfirm
func (*BlockChain) ReceiveConfirms ¶
func (bc *BlockChain) ReceiveConfirms(pack protocol.BlockConfirms)
ReceiveConfirms receive confirm package from net connection
func (*BlockChain) SetMinedBlock ¶
func (bc *BlockChain) SetMinedBlock(block *types.Block) error
SetMinedBlock 挖到新块
func (*BlockChain) SetStableBlock ¶
SetStableBlock
func (*BlockChain) StableBlock ¶
func (bc *BlockChain) StableBlock() *types.Block
StableBlock get latest stable block
func (*BlockChain) TxProcessor ¶
func (bc *BlockChain) TxProcessor() *TxProcessor
type ChainContext ¶
type ChainContext interface { // GetBlockByHash returns the hash corresponding to their hash. GetBlockByHash(hash common.Hash) *types.Block }
ChainContext supports retrieving headers and consensus parameters from the current blockchain to be used during transaction processing.
type Dpovp ¶
type Dpovp struct {
// contains filtered or unexported fields
}
type EngineTestForChain ¶
type EngineTestForChain struct{}
func (*EngineTestForChain) Finalize ¶
func (engine *EngineTestForChain) Finalize(header *types.Header, am *account.Manager)
func (*EngineTestForChain) VerifyHeader ¶
func (engine *EngineTestForChain) VerifyHeader(block *types.Block) error
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.
type TransactionWithTime ¶
type TransactionWithTime struct { Tx *types.Transaction RecTime int64 DelFlg bool }
type TxProcessor ¶
type TxProcessor struct {
// contains filtered or unexported fields
}
func NewTxProcessor ¶
func NewTxProcessor(bc *BlockChain) *TxProcessor
func (*TxProcessor) ApplyTxs ¶
func (p *TxProcessor) ApplyTxs(header *types.Header, txs types.Transactions) (*types.Header, types.Transactions, types.Transactions, error)
ApplyTxs picks and processes transactions from miner's tx pool.
func (*TxProcessor) FillHeader ¶
func (p *TxProcessor) FillHeader(header *types.Header, txs types.Transactions, gasUsed uint64) (*types.Header, error)
FillHeader creates a new header then fills it with the result of transactions process
type TxsSort ¶
type TxsSort interface {
// contains filtered or unexported methods
}
func NewTxsSortByTime ¶
func NewTxsSortByTime() TxsSort
type TxsSortByTime ¶
type TxsSortByTime struct {
// contains filtered or unexported fields
}
Source Files ¶
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. |