Documentation ¶
Index ¶
- Constants
- Variables
- func MakeResultData(i interface{}) define.Result
- func OpenDatabase(datadir string, name string, cache int, handles int) (ethdb.Database, error)
- type BTApplication
- func (app *BTApplication) BeginBlock(req abcitypes.RequestBeginBlock) abcitypes.ResponseBeginBlock
- func (app *BTApplication) CheckTx(tx []byte) abcitypes.ResponseCheckTx
- func (app *BTApplication) CheckValidatorUpdate(tx *define.Transaction) error
- func (app *BTApplication) Commit() abcitypes.ResponseCommit
- func (app *BTApplication) DBSwitch()
- func (app *BTApplication) DeliverTx(tx []byte) abcitypes.ResponseDeliverTx
- func (app *BTApplication) DeliverValidatorUpdate(tx *define.Transaction) error
- func (app *BTApplication) EndBlock(req abcitypes.RequestEndBlock) abcitypes.ResponseEndBlock
- func (app *BTApplication) Info(req abcitypes.RequestInfo) (resInfo abcitypes.ResponseInfo)
- func (app *BTApplication) InitChain(req abcitypes.RequestInitChain) abcitypes.ResponseInitChain
- func (app *BTApplication) LoadLastBlock() (lastBlock LastBlockInfo)
- func (app *BTApplication) Query(reqQuery abcitypes.RequestQuery) (resQuery abcitypes.ResponseQuery)
- func (app *BTApplication) QueryAccount(addr []byte) define.Result
- func (app *BTApplication) QueryTx(tx []byte) define.Result
- func (app *BTApplication) SaveDBData() error
- func (app *BTApplication) SaveLastBlock(appHash []byte, header *define.AppHeader)
- type LastBlockInfo
- type ValidatorMgr
Constants ¶
View Source
const ( LDatabaseCache = 128 LDatabaseHandles = 1024 )
View Source
const ( QUERY_TX = "/tx" QUERY_ACCOUNT = "/account" QUERY_NONCE = "/nonce" )
Variables ¶
View Source
var ( ZERO_ADDRESS = ethcmn.Address{} ZERO_HASH = ethcmn.Hash{} )
View Source
var (
EmptyTrieRoot = ethcmn.HexToHash("0000000000000000000000000000000000000000000000000000000000000000")
)
Functions ¶
func MakeResultData ¶
Types ¶
type BTApplication ¶
type BTApplication struct { abcitypes.BaseApplication // contains filtered or unexported fields }
func NewBTApplication ¶
func NewBTApplication() *BTApplication
func (*BTApplication) BeginBlock ¶
func (app *BTApplication) BeginBlock(req abcitypes.RequestBeginBlock) abcitypes.ResponseBeginBlock
BeginBlock 区块开始,记录区块高度和hash
func (*BTApplication) CheckTx ¶
func (app *BTApplication) CheckTx(tx []byte) abcitypes.ResponseCheckTx
CheckTx 初步检查,如果check失败,将不会被打包
func (*BTApplication) CheckValidatorUpdate ¶
func (app *BTApplication) CheckValidatorUpdate(tx *define.Transaction) error
func (*BTApplication) Commit ¶
func (app *BTApplication) Commit() abcitypes.ResponseCommit
func (*BTApplication) DBSwitch ¶
func (app *BTApplication) DBSwitch()
func (*BTApplication) DeliverTx ¶
func (app *BTApplication) DeliverTx(tx []byte) abcitypes.ResponseDeliverTx
func (*BTApplication) DeliverValidatorUpdate ¶
func (app *BTApplication) DeliverValidatorUpdate(tx *define.Transaction) error
func (*BTApplication) EndBlock ¶
func (app *BTApplication) EndBlock(req abcitypes.RequestEndBlock) abcitypes.ResponseEndBlock
EndBlock https://tendermint.com/docs/spec/abci/apps.html#validator-updates
func (*BTApplication) Info ¶
func (app *BTApplication) Info(req abcitypes.RequestInfo) (resInfo abcitypes.ResponseInfo)
Info TM Core启动时会查询chain信息 需要返回lastBlock相关信息,否则会从第一个块replay
func (*BTApplication) InitChain ¶
func (app *BTApplication) InitChain(req abcitypes.RequestInitChain) abcitypes.ResponseInitChain
func (*BTApplication) LoadLastBlock ¶
func (app *BTApplication) LoadLastBlock() (lastBlock LastBlockInfo)
func (*BTApplication) Query ¶
func (app *BTApplication) Query(reqQuery abcitypes.RequestQuery) (resQuery abcitypes.ResponseQuery)
func (*BTApplication) QueryAccount ¶
func (app *BTApplication) QueryAccount(addr []byte) define.Result
func (*BTApplication) SaveDBData ¶
func (app *BTApplication) SaveDBData() error
func (*BTApplication) SaveLastBlock ¶
func (app *BTApplication) SaveLastBlock(appHash []byte, header *define.AppHeader)
type LastBlockInfo ¶
type ValidatorMgr ¶
type ValidatorMgr struct {
// contains filtered or unexported fields
}
validators 说明 InitChain时参数中的validatorset是创世配置文件中配置的内容,本方法只调一次,程序重启不再调用 BeginBlock中的validator是空的,无法使用 validator持久化到leveldb了,包含从创世以来所有的validator信息,power=0时不移除 更新注意:如果power double set0,TMCore会出现一致性错误,必须重新创世
如果power不为0,如果网络不通也有可能出现问题,因此需要谨慎更新validator
func NewValidatorMgr ¶
func NewValidatorMgr(chainDb ethdb.Database) *ValidatorMgr
func (*ValidatorMgr) Save ¶
func (p *ValidatorMgr) Save(vl *define.Validator)
func (*ValidatorMgr) String ¶
func (p *ValidatorMgr) String() string
Click to show internal directories.
Click to hide internal directories.