candy

package
v0.0.0-...-f47aca1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ValidatorSetChangePrefix = "val:"
)

Variables

This section is empty.

Functions

func DefaultAnteHandler

func DefaultAnteHandler(tx Tx, manager AccountManager) error

func DefaultBeginBlocker

func DefaultBeginBlocker(base *BaseApp, req types.RequestBeginBlock) types.ResponseBeginBlock

func DefaultEndBlocker

func DefaultEndBlocker(base *BaseApp, req types.RequestEndBlock) types.ResponseEndBlock

func DefaultInitChainer

func DefaultInitChainer(base *BaseApp, req types.RequestInitChain) types.ResponseInitChain

Types

type AccountManager

type AccountManager interface {
	VerifySignature(msg, sign []byte) bool
}

type AnteHandler

type AnteHandler func(tx Tx, manager AccountManager) error

type AppStateStore

type AppStateStore struct {
	// contains filtered or unexported fields
}

func (*AppStateStore) Commit

func (ass *AppStateStore) Commit(lastCommitHash []byte) CommitID

func (*AppStateStore) Get

func (ass *AppStateStore) Get(key []byte) ([]byte, error)

func (*AppStateStore) LastCommitID

func (ass *AppStateStore) LastCommitID() CommitID

func (*AppStateStore) Set

func (ass *AppStateStore) Set(key, value []byte) error

type BaseApp

type BaseApp struct {
	types.BaseApplication
	// contains filtered or unexported fields
}

func NewBaseApp

func NewBaseApp(name string, caller ContractCaller, manager AccountManager, dir string) *BaseApp

func (*BaseApp) AppVersion

func (app *BaseApp) AppVersion() string

AppVersion returns the application's version string.

func (*BaseApp) BeginBlock

func (*BaseApp) CheckTx

func (app *BaseApp) CheckTx(req types.RequestCheckTx) types.ResponseCheckTx

func (*BaseApp) Commit

func (app *BaseApp) Commit() types.ResponseCommit

func (*BaseApp) DeliverTx

func (*BaseApp) EndBlock

func (app *BaseApp) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock

func (*BaseApp) Info

func (app *BaseApp) Info(req types.RequestInfo) types.ResponseInfo

func (*BaseApp) InitChain

func (app *BaseApp) InitChain(req types.RequestInitChain) (res types.ResponseInitChain)

func (*BaseApp) LastBlockHeight

func (app *BaseApp) LastBlockHeight() int64

LastBlockHeight returns the last committed block height.

func (*BaseApp) LastCommitID

func (app *BaseApp) LastCommitID() CommitID

LastCommitID returns the last CommitID of the multistore.

func (*BaseApp) Logger

func (app *BaseApp) Logger() log.Logger

Logger returns the logger of the BaseApp.

func (*BaseApp) Name

func (app *BaseApp) Name() string

Name returns the name of the BaseApp.

func (*BaseApp) Query

func (app *BaseApp) Query(req types.RequestQuery) types.ResponseQuery

func (*BaseApp) SetOption

type BeginBlocker

type BeginBlocker func(base *BaseApp, req types.RequestBeginBlock) types.ResponseBeginBlock

BeginBlocker runs code before the transactions in a block

Note: applications which set create_empty_blocks=false will not have regular block timing and should use e.g. BFT timestamps rather than block height for any periodic BeginBlock logic

type CommitID

type CommitID struct {
	Version int64
	Hash    []byte
}

CommitID contains the tree version number and its merkle root.

func (CommitID) IsZero

func (cid CommitID) IsZero() bool

func (CommitID) String

func (cid CommitID) String() string

type Committer

type Committer interface {
	Set([]byte, []byte) error
	Get([]byte) ([]byte, error)
	Commit([]byte) CommitID
	LastCommitID() CommitID
}

something that can persist to disk

type Context

type Context struct {
	// contains filtered or unexported fields
}

func NewContext

func NewContext(header types.Header, isCheckTx bool, logger log.Logger) Context

func (Context) BlockHeader

func (c Context) BlockHeader() types.Header

func (Context) BlockHeight

func (c Context) BlockHeight() int64

func (Context) BlockTime

func (c Context) BlockTime() time.Time

func (Context) ChainID

func (c Context) ChainID() string

func (Context) ConsensusParams

func (c Context) ConsensusParams() *types.ConsensusParams

func (Context) Context

func (c Context) Context() context.Context

func (Context) IsCheckTx

func (c Context) IsCheckTx() bool

func (Context) IsReCheckTx

func (c Context) IsReCheckTx() bool

func (Context) Logger

func (c Context) Logger() log.Logger

func (Context) TxBytes

func (c Context) TxBytes() []byte

func (Context) Value

func (c Context) Value(key interface{}) interface{}

Value is deprecated, provided for backwards compatibility Please use

ctx.Context().Value(key)

instead of

ctx.Value(key)

func (Context) VoteInfos

func (c Context) VoteInfos() []types.VoteInfo

func (Context) WithBlockHeader

func (c Context) WithBlockHeader(header types.Header) Context

func (Context) WithBlockHeight

func (c Context) WithBlockHeight(height int64) Context

func (Context) WithBlockTime

func (c Context) WithBlockTime(newTime time.Time) Context

func (Context) WithChainID

func (c Context) WithChainID(chainID string) Context

func (Context) WithConsensusParams

func (c Context) WithConsensusParams(params *types.ConsensusParams) Context

func (Context) WithContext

func (c Context) WithContext(ctx context.Context) Context

func (Context) WithIsCheckTx

func (c Context) WithIsCheckTx(isCheckTx bool) Context

func (Context) WithIsReCheckTx

func (c Context) WithIsReCheckTx(isRecheckTx bool) Context

WithIsRecheckTx called with true will also set true on checkTx in order to enforce the invariant that if recheckTx = true then checkTx = true as well.

func (Context) WithLogger

func (c Context) WithLogger(logger log.Logger) Context

func (Context) WithProposer

func (c Context) WithProposer(addr []byte) Context

func (Context) WithTxBytes

func (c Context) WithTxBytes(txBytes []byte) Context

func (Context) WithValue

func (c Context) WithValue(key, value interface{}) Context

WithValue is deprecated, provided for backwards compatibility Please use

ctx = ctx.WithContext(context.WithValue(ctx.Context(), key, false))

instead of

ctx = ctx.WithValue(key, false)

func (Context) WithVoteInfos

func (c Context) WithVoteInfos(voteInfo []types.VoteInfo) Context

type ContractCaller

type ContractCaller interface {
	// CallContract sends message to the specified contract container and waits for response
	CallContract(cId string, args [][]byte) (*pb.ContractOutput, error)

	// QueryContractList gets all installed contacts
	QueryContractList() []string
}

ContractCaller chats with contracts

type EndBlocker

type EndBlocker func(base *BaseApp, req types.RequestEndBlock) types.ResponseEndBlock

EndBlocker runs code after the transactions in a block and return updates to the validator set

Note: applications which set create_empty_blocks=false will not have regular block timing and should use e.g. BFT timestamps rather than block height for any periodic EndBlock logic

type InitChainer

type InitChainer func(base *BaseApp, req types.RequestInitChain) types.ResponseInitChain

InitChainer initializes application state at genesis

type PeerFilter

type PeerFilter func(info string) types.ResponseQuery

PeerFilter responds to p2p filtering queries from Tendermint

type Transaction

type Transaction struct {
	Contract  string
	Args      [][]byte
	Function  string
	PubKey    crypto.PubKey
	Signature []byte
}

func (*Transaction) GetArgs

func (t *Transaction) GetArgs() [][]byte

func (*Transaction) GetContractName

func (t *Transaction) GetContractName() string

func (*Transaction) GetFunctionName

func (t *Transaction) GetFunctionName() string

func (*Transaction) GetSignBytes

func (t *Transaction) GetSignBytes() []byte

func (*Transaction) GetSignature

func (t *Transaction) GetSignature() []byte

func (*Transaction) GetSigner

func (t *Transaction) GetSigner() crypto.Address

func (*Transaction) GetStringArgs

func (t *Transaction) GetStringArgs() []string

func (*Transaction) ValidateBasic

func (t *Transaction) ValidateBasic() error

type Tx

type Tx interface {
	// Gets the Tx's contract name
	GetContractName() string

	// Get the Tx's function name
	GetFunctionName() string

	GetArgs() [][]byte

	GetStringArgs() []string

	// ValidateBasic does a simple and lightweight validation check that doesn't
	// require access to any other information.
	ValidateBasic() error

	GetSignBytes() []byte

	// GetSignature the canonical byte representation of the Tx.
	GetSignature() []byte

	// GetSigner returns the address of signer that must sign.
	GetSigner() crypto.Address
}

Transactions objects must fulfill the Tx

func DefaultTxDecoder

func DefaultTxDecoder(txBytes []byte) (Tx, error)

type TxDecoder

type TxDecoder func(txBytes []byte) (Tx, error)

TxDecoder unmarshals transaction bytes

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL