Documentation ¶
Index ¶
- Constants
- Variables
- func GenDefaultPrivKey() crypto.PrivKey
- func InitKVStore(app *PersistentKVStoreApplication)
- func LoadPrivValidatorKeyFile(keyFilePath string) (*privval.FilePVKey, error)
- func MakeValSetChangeTx(pubkey pc.PublicKey, power int64) []byte
- func MakeValSetChangeTxAndMore(pubkey pc.PublicKey, power int64) (string, string)
- func RandVal(i int) types.ValidatorUpdate
- func RandVals(cnt int) []types.ValidatorUpdate
- type Application
- func (app *Application) CheckTxAsync(req types.RequestCheckTx, callback ocabci.CheckTxCallback)
- func (app *Application) CheckTxSync(req types.RequestCheckTx) ocabci.ResponseCheckTx
- func (app *Application) Commit() types.ResponseCommit
- func (app *Application) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx
- func (app *Application) Info(req types.RequestInfo) (resInfo types.ResponseInfo)
- func (app *Application) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
- type PersistentKVStoreApplication
- func (app *PersistentKVStoreApplication) ApplySnapshotChunk(req types.RequestApplySnapshotChunk) types.ResponseApplySnapshotChunk
- func (app *PersistentKVStoreApplication) BeginBlock(req ocabci.RequestBeginBlock) types.ResponseBeginBlock
- func (app *PersistentKVStoreApplication) BeginRecheckTx(req ocabci.RequestBeginRecheckTx) ocabci.ResponseBeginRecheckTx
- func (app *PersistentKVStoreApplication) CheckTxAsync(req types.RequestCheckTx, callback ocabci.CheckTxCallback)
- func (app *PersistentKVStoreApplication) CheckTxSync(req types.RequestCheckTx) ocabci.ResponseCheckTx
- func (app *PersistentKVStoreApplication) Commit() types.ResponseCommit
- func (app *PersistentKVStoreApplication) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx
- func (app *PersistentKVStoreApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock
- func (app *PersistentKVStoreApplication) EndRecheckTx(req ocabci.RequestEndRecheckTx) ocabci.ResponseEndRecheckTx
- func (app *PersistentKVStoreApplication) Info(req types.RequestInfo) types.ResponseInfo
- func (app *PersistentKVStoreApplication) InitChain(req types.RequestInitChain) types.ResponseInitChain
- func (app *PersistentKVStoreApplication) ListSnapshots(req types.RequestListSnapshots) types.ResponseListSnapshots
- func (app *PersistentKVStoreApplication) LoadSnapshotChunk(req types.RequestLoadSnapshotChunk) types.ResponseLoadSnapshotChunk
- func (app *PersistentKVStoreApplication) OfferSnapshot(req types.RequestOfferSnapshot) types.ResponseOfferSnapshot
- func (app *PersistentKVStoreApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
- func (app *PersistentKVStoreApplication) SetLogger(l log.Logger)
- func (app *PersistentKVStoreApplication) SetOption(req types.RequestSetOption) types.ResponseSetOption
- func (app *PersistentKVStoreApplication) Validators() (validators []types.ValidatorUpdate)
- type State
Constants ¶
const (
ValidatorSetChangePrefix string = "val:"
)
Variables ¶
var (
ProtocolVersion uint64 = 99
)
Functions ¶
func GenDefaultPrivKey ¶
GenDefaultPrivKey Generates a default private key for use in an example or test.
func InitKVStore ¶
func InitKVStore(app *PersistentKVStoreApplication)
InitKVStore initializes the kvstore app with some data, which allows tests to pass and is fine as long as you don't make any tx that modify the validator state
func LoadPrivValidatorKeyFile ¶
LoadPrivValidatorKeyFile Load private key for use in an example or test.
func RandVal ¶
func RandVal(i int) types.ValidatorUpdate
RandVal creates one random validator, with a key derived from the input value
func RandVals ¶
func RandVals(cnt int) []types.ValidatorUpdate
RandVals returns a list of cnt validators for initializing the application. Note that the keys are deterministically derived from the index in the array, while the power is random (Change this if not desired)
Types ¶
type Application ¶
type Application struct { ocabci.BaseApplication RetainBlocks int64 // blocks to retain after commit (via ResponseCommit.RetainHeight) // contains filtered or unexported fields }
func NewApplication ¶
func NewApplication() *Application
func (*Application) CheckTxAsync ¶
func (app *Application) CheckTxAsync(req types.RequestCheckTx, callback ocabci.CheckTxCallback)
func (*Application) CheckTxSync ¶
func (app *Application) CheckTxSync(req types.RequestCheckTx) ocabci.ResponseCheckTx
func (*Application) Commit ¶
func (app *Application) Commit() types.ResponseCommit
func (*Application) DeliverTx ¶
func (app *Application) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx
tx is either "key=value" or just arbitrary bytes
func (*Application) Info ¶
func (app *Application) Info(req types.RequestInfo) (resInfo types.ResponseInfo)
func (*Application) Query ¶
func (app *Application) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
Returns an associated value or nil if missing.
type PersistentKVStoreApplication ¶
type PersistentKVStoreApplication struct { // validator set ValUpdates []types.ValidatorUpdate // contains filtered or unexported fields }
func NewPersistentKVStoreApplication ¶
func NewPersistentKVStoreApplication(dbDir string) *PersistentKVStoreApplication
func (*PersistentKVStoreApplication) ApplySnapshotChunk ¶
func (app *PersistentKVStoreApplication) ApplySnapshotChunk( req types.RequestApplySnapshotChunk) types.ResponseApplySnapshotChunk
func (*PersistentKVStoreApplication) BeginBlock ¶
func (app *PersistentKVStoreApplication) BeginBlock(req ocabci.RequestBeginBlock) types.ResponseBeginBlock
Track the block hash and header information
func (*PersistentKVStoreApplication) BeginRecheckTx ¶
func (app *PersistentKVStoreApplication) BeginRecheckTx(req ocabci.RequestBeginRecheckTx) ocabci.ResponseBeginRecheckTx
func (*PersistentKVStoreApplication) CheckTxAsync ¶
func (app *PersistentKVStoreApplication) CheckTxAsync(req types.RequestCheckTx, callback ocabci.CheckTxCallback)
func (*PersistentKVStoreApplication) CheckTxSync ¶
func (app *PersistentKVStoreApplication) CheckTxSync(req types.RequestCheckTx) ocabci.ResponseCheckTx
func (*PersistentKVStoreApplication) Commit ¶
func (app *PersistentKVStoreApplication) Commit() types.ResponseCommit
Commit will panic if InitChain was not called
func (*PersistentKVStoreApplication) DeliverTx ¶
func (app *PersistentKVStoreApplication) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx
tx is either "val:pubkey!power" or "key=value" or just arbitrary bytes
func (*PersistentKVStoreApplication) EndBlock ¶
func (app *PersistentKVStoreApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock
Update the validator set
func (*PersistentKVStoreApplication) EndRecheckTx ¶
func (app *PersistentKVStoreApplication) EndRecheckTx(req ocabci.RequestEndRecheckTx) ocabci.ResponseEndRecheckTx
func (*PersistentKVStoreApplication) Info ¶
func (app *PersistentKVStoreApplication) Info(req types.RequestInfo) types.ResponseInfo
func (*PersistentKVStoreApplication) InitChain ¶
func (app *PersistentKVStoreApplication) InitChain(req types.RequestInitChain) types.ResponseInitChain
Save the validators in the merkle tree
func (*PersistentKVStoreApplication) ListSnapshots ¶
func (app *PersistentKVStoreApplication) ListSnapshots( req types.RequestListSnapshots) types.ResponseListSnapshots
func (*PersistentKVStoreApplication) LoadSnapshotChunk ¶
func (app *PersistentKVStoreApplication) LoadSnapshotChunk( req types.RequestLoadSnapshotChunk) types.ResponseLoadSnapshotChunk
func (*PersistentKVStoreApplication) OfferSnapshot ¶
func (app *PersistentKVStoreApplication) OfferSnapshot( req types.RequestOfferSnapshot) types.ResponseOfferSnapshot
func (*PersistentKVStoreApplication) Query ¶
func (app *PersistentKVStoreApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
When path=/val and data={validator address}, returns the validator update (types.ValidatorUpdate) varint encoded. For any other path, returns an associated value or nil if missing.
func (*PersistentKVStoreApplication) SetLogger ¶
func (app *PersistentKVStoreApplication) SetLogger(l log.Logger)
func (*PersistentKVStoreApplication) SetOption ¶
func (app *PersistentKVStoreApplication) SetOption(req types.RequestSetOption) types.ResponseSetOption
func (*PersistentKVStoreApplication) Validators ¶
func (app *PersistentKVStoreApplication) Validators() (validators []types.ValidatorUpdate)