Documentation ¶
Index ¶
- Variables
- func AddCommonCheckTxEvents(resp *types.ResponseCheckTx, tx Tx) *types.ResponseCheckTx
- type App
- func (app *App) ApplySnapshotChunk(_ context.Context, req *types.RequestApplySnapshotChunk) (*types.ResponseApplySnapshotChunk, error)
- func (app *App) CheckTx(_ context.Context, req *types.RequestCheckTx) (*types.ResponseCheckTx, error)
- func (app *App) Commit(_ context.Context, req *types.RequestCommit) (*types.ResponseCommit, error)
- func (app *App) FinalizeBlock(_ context.Context, req *types.RequestFinalizeBlock) (*types.ResponseFinalizeBlock, error)
- func (app *App) GetChainID() string
- func (app *App) GetTx(tx []byte) (Tx, error)
- func (app *App) HandleCheckTx(cmd txn.Command, fn TxHandler) *App
- func (app *App) HandleDeliverTx(cmd txn.Command, fn TxHandler) *App
- func (app *App) Info(ctx context.Context, req *types.RequestInfo) (*types.ResponseInfo, error)
- func (app *App) InitChain(_ context.Context, req *types.RequestInitChain) (*types.ResponseInitChain, error)
- func (app *App) ListSnapshots(ctx context.Context, req *types.RequestListSnapshots) (*types.ResponseListSnapshots, error)
- func (app *App) LoadSnapshotChunk(ctx context.Context, req *types.RequestLoadSnapshotChunk) (*types.ResponseLoadSnapshotChunk, error)
- func (app *App) OfferSnapshot(ctx context.Context, req *types.RequestOfferSnapshot) (*types.ResponseOfferSnapshot, error)
- func (app *App) PrepareProposal(_ context.Context, req *types.RequestPrepareProposal) (*types.ResponsePrepareProposal, error)
- func (app *App) ProcessProposal(_ context.Context, req *types.RequestProcessProposal) (*types.ResponseProcessProposal, error)
- func (app *App) SetChainID(chainID string)
- type ApplySnapshotChunkHandler
- type Client
- func (c *Client) CheckTransaction(ctx context.Context, bytes []byte) (*tmctypes.ResultCheckTx, error)
- func (c *Client) Genesis(ctx context.Context) (*tmtypes.GenesisDoc, error)
- func (c *Client) GenesisValidators(ctx context.Context) ([]*tmtypes.Validator, error)
- func (c *Client) GetChainID(ctx context.Context) (chainID string, err error)
- func (c *Client) GetGenesisTime(ctx context.Context) (genesisTime time.Time, err error)
- func (c *Client) GetNetworkInfo(ctx context.Context) (netInfo *tmctypes.ResultNetInfo, err error)
- func (c *Client) GetStatus(ctx context.Context) (status *tmctypes.ResultStatus, err error)
- func (c *Client) GetUnconfirmedTxCount(ctx context.Context) (count int, err error)
- func (c *Client) Health(ctx context.Context) (*tmctypes.ResultHealth, error)
- func (c *Client) SendTransactionAsync(ctx context.Context, bytes []byte) (*tmctypes.ResultBroadcastTx, error)
- func (c *Client) SendTransactionCommit(ctx context.Context, bytes []byte) (*tmctypes.ResultBroadcastTxCommit, error)
- func (c *Client) SendTransactionSync(ctx context.Context, bytes []byte) (*tmctypes.ResultBroadcastTx, error)
- func (c *Client) Start() error
- func (c *Client) Subscribe(ctx context.Context, fn func(tmctypes.ResultEvent) error, queries ...string) error
- func (c *Client) Validators(ctx context.Context, height *int64) ([]*tmtypes.Validator, error)
- type Codec
- type Command
- type FinalizeHandler
- type GenesisState
- type InfoHandler
- type ListSnapshotsHandler
- type LoadSnapshotChunkHandler
- type LocalClient
- func (c *LocalClient) CheckTransaction(ctx context.Context, bytes []byte) (*tmctypes.ResultCheckTx, error)
- func (c *LocalClient) Genesis(ctx context.Context) (*tmtypes.GenesisDoc, error)
- func (c *LocalClient) GenesisValidators(ctx context.Context) ([]*tmtypes.Validator, error)
- func (c *LocalClient) GetChainID(ctx context.Context) (chainID string, err error)
- func (c *LocalClient) GetGenesisTime(ctx context.Context) (genesisTime time.Time, err error)
- func (c *LocalClient) GetNetworkInfo(ctx context.Context) (netInfo *tmctypes.ResultNetInfo, err error)
- func (c *LocalClient) GetStatus(ctx context.Context) (status *tmctypes.ResultStatus, err error)
- func (c *LocalClient) GetUnconfirmedTxCount(ctx context.Context) (count int, err error)
- func (c *LocalClient) Health(ctx context.Context) (*tmctypes.ResultHealth, error)
- func (c *LocalClient) SendTransactionAsync(ctx context.Context, bytes []byte) (*tmctypes.ResultBroadcastTx, error)
- func (c *LocalClient) SendTransactionCommit(ctx context.Context, bytes []byte) (*tmctypes.ResultBroadcastTxCommit, error)
- func (c *LocalClient) SendTransactionSync(ctx context.Context, bytes []byte) (*tmctypes.ResultBroadcastTx, error)
- func (c *LocalClient) Start() error
- func (c *LocalClient) Subscribe(ctx context.Context, fn func(tmctypes.ResultEvent) error, queries ...string) error
- func (c *LocalClient) Validators(ctx context.Context, height *int64) ([]*tmtypes.Validator, error)
- type MaybePartialError
- type OfferSnapshotHandler
- type OnBeginBlockHandler
- type OnCheckTxHandler
- type OnCheckTxSpamHandler
- type OnCommitHandler
- type OnDeliverTxHandler
- type OnEndBlockHandler
- type OnInitChainHandler
- type PrepareProposalHandler
- type ProcessProposalHandler
- type SnapshotEngine
- type TmLogger
- type TmNode
- type Tx
- type TxHandler
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyClientAddr = errors.New("abci client addr is empty in config")
var ErrNoNetworkGenesisState = errors.New("no network genesis state")
Functions ¶
func AddCommonCheckTxEvents ¶
func AddCommonCheckTxEvents(resp *types.ResponseCheckTx, tx Tx) *types.ResponseCheckTx
Types ¶
type App ¶
type App struct { abci.BaseApplication // handlers OnPrepareProposal PrepareProposalHandler OnProcessProposal ProcessProposalHandler OnInitChain OnInitChainHandler OnCheckTx OnCheckTxHandler OnCommit OnCommitHandler OnBeginBlock OnBeginBlockHandler OnEndBlock OnEndBlockHandler OnFinalize FinalizeHandler // spam check OnCheckTxSpam OnCheckTxSpamHandler OnListSnapshots ListSnapshotsHandler OnOfferSnapshot OfferSnapshotHandler OnLoadSnapshotChunk LoadSnapshotChunkHandler OnApplySnapshotChunk ApplySnapshotChunkHandler OnInfo InfoHandler // contains filtered or unexported fields }
func (*App) ApplySnapshotChunk ¶
func (app *App) ApplySnapshotChunk(_ context.Context, req *types.RequestApplySnapshotChunk) (*types.ResponseApplySnapshotChunk, error)
func (*App) CheckTx ¶
func (app *App) CheckTx(_ context.Context, req *types.RequestCheckTx) (*types.ResponseCheckTx, error)
func (*App) Commit ¶
func (app *App) Commit(_ context.Context, req *types.RequestCommit) (*types.ResponseCommit, error)
func (*App) FinalizeBlock ¶ added in v0.74.0
func (app *App) FinalizeBlock(_ context.Context, req *types.RequestFinalizeBlock) (*types.ResponseFinalizeBlock, error)
FinalizeBlock lets the application process a whole block end to end.
func (*App) GetChainID ¶
func (*App) Info ¶
func (app *App) Info(ctx context.Context, req *types.RequestInfo) (*types.ResponseInfo, error)
func (*App) InitChain ¶
func (app *App) InitChain(_ context.Context, req *types.RequestInitChain) (*types.ResponseInitChain, error)
func (*App) ListSnapshots ¶
func (app *App) ListSnapshots(ctx context.Context, req *types.RequestListSnapshots) (*types.ResponseListSnapshots, error)
func (*App) LoadSnapshotChunk ¶
func (app *App) LoadSnapshotChunk(ctx context.Context, req *types.RequestLoadSnapshotChunk) (*types.ResponseLoadSnapshotChunk, error)
func (*App) OfferSnapshot ¶
func (app *App) OfferSnapshot(ctx context.Context, req *types.RequestOfferSnapshot) (*types.ResponseOfferSnapshot, error)
func (*App) PrepareProposal ¶ added in v0.74.0
func (app *App) PrepareProposal(_ context.Context, req *types.RequestPrepareProposal) (*types.ResponsePrepareProposal, error)
PrepareProposal will take the given transactions from the mempool and attempts to prepare a proposal from them when it's our turn to do so while keeping the size, gas, pow, and spam constraints.
func (*App) ProcessProposal ¶ added in v0.74.0
func (app *App) ProcessProposal(_ context.Context, req *types.RequestProcessProposal) (*types.ResponseProcessProposal, error)
ProcessProposal implements part of the Application interface. It accepts any proposal that does not contain a malformed transaction. NB: processProposal will not be called if the node is fast-sync-ing so no state change is allowed here!!!.
func (*App) SetChainID ¶
type ApplySnapshotChunkHandler ¶
type ApplySnapshotChunkHandler func(context.Context, *types.RequestApplySnapshotChunk) (*types.ResponseApplySnapshotChunk, error)
ABCI hooks.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CheckTransaction ¶
func (*Client) GenesisValidators ¶
func (*Client) GetChainID ¶
GetChainID retrieves the chainID from the blockchain.
func (*Client) GetGenesisTime ¶
GetGenesisTime retrieves the genesis time from the blockchain.
func (*Client) GetNetworkInfo ¶
GetNetworkInfo return information of the current network.
func (*Client) GetUnconfirmedTxCount ¶
GetUnconfirmedTxCount return the current count of unconfirmed transactions.
func (*Client) SendTransactionAsync ¶
func (*Client) SendTransactionCommit ¶
func (*Client) SendTransactionSync ¶
func (*Client) Subscribe ¶
func (c *Client) Subscribe(ctx context.Context, fn func(tmctypes.ResultEvent) error, queries ...string) error
Subscribe subscribes to any event matching query (https://godoc.org/github.com/cometbft/cometbft/types#pkg-constants). Subscribe will call fn each time it receives an event from the node. The function returns nil when the context is canceled or when fn returns an error.
type GenesisState ¶
type GenesisState struct { // ReplayAttackThreshold protects the network against replay attacks. It sets a // toleration thershold between the current block in the chain and the block // heigh specified in the Tx. Tx with blocks height >= than (chain's height - // distance) are rejected with a AbciTxnRejected. It also keeps a ring-buffer // to cache seen Tx. The Ring buffer size defines the number of block to cache, // each block can hold an unlimited number of Txs. ReplayAttackThreshold uint `json:"replay_attack_threshold"` }
func DefaultGenesis ¶
func DefaultGenesis() GenesisState
func LoadGenesisState ¶
func LoadGenesisState(bytes []byte) (*GenesisState, error)
type InfoHandler ¶
type InfoHandler func(context.Context, *types.RequestInfo) (*types.ResponseInfo, error)
ABCI hooks.
type ListSnapshotsHandler ¶
type ListSnapshotsHandler func(context.Context, *types.RequestListSnapshots) (*types.ResponseListSnapshots, error)
ABCI hooks.
type LoadSnapshotChunkHandler ¶
type LoadSnapshotChunkHandler func(context.Context, *types.RequestLoadSnapshotChunk) (*types.ResponseLoadSnapshotChunk, error)
ABCI hooks.
type LocalClient ¶
type LocalClient struct {
// contains filtered or unexported fields
}
func (*LocalClient) CheckTransaction ¶
func (c *LocalClient) CheckTransaction(ctx context.Context, bytes []byte) (*tmctypes.ResultCheckTx, error)
func (*LocalClient) Genesis ¶
func (c *LocalClient) Genesis(ctx context.Context) (*tmtypes.GenesisDoc, error)
func (*LocalClient) GenesisValidators ¶
func (*LocalClient) GetChainID ¶
func (c *LocalClient) GetChainID(ctx context.Context) (chainID string, err error)
GetChainID retrieves the chainID from the blockchain.
func (*LocalClient) GetGenesisTime ¶
GetGenesisTime retrieves the genesis time from the blockchain.
func (*LocalClient) GetNetworkInfo ¶
func (c *LocalClient) GetNetworkInfo(ctx context.Context) (netInfo *tmctypes.ResultNetInfo, err error)
GetNetworkInfo return information of the current network.
func (*LocalClient) GetStatus ¶
func (c *LocalClient) GetStatus(ctx context.Context) (status *tmctypes.ResultStatus, err error)
GetStatus returns the current status of the chain.
func (*LocalClient) GetUnconfirmedTxCount ¶
func (c *LocalClient) GetUnconfirmedTxCount(ctx context.Context) (count int, err error)
GetUnconfirmedTxCount return the current count of unconfirmed transactions.
func (*LocalClient) Health ¶
func (c *LocalClient) Health(ctx context.Context) (*tmctypes.ResultHealth, error)
Health returns the result of the health endpoint of the chain.
func (*LocalClient) SendTransactionAsync ¶
func (c *LocalClient) SendTransactionAsync(ctx context.Context, bytes []byte) (*tmctypes.ResultBroadcastTx, error)
func (*LocalClient) SendTransactionCommit ¶
func (c *LocalClient) SendTransactionCommit(ctx context.Context, bytes []byte) (*tmctypes.ResultBroadcastTxCommit, error)
func (*LocalClient) SendTransactionSync ¶
func (c *LocalClient) SendTransactionSync(ctx context.Context, bytes []byte) (*tmctypes.ResultBroadcastTx, error)
func (*LocalClient) Start ¶
func (c *LocalClient) Start() error
func (*LocalClient) Subscribe ¶
func (c *LocalClient) Subscribe(ctx context.Context, fn func(tmctypes.ResultEvent) error, queries ...string) error
Subscribe subscribes to any event matching query (https://godoc.org/github.com/cometbft/cometbft/types#pkg-constants). Subscribe will call fn each time it receives an event from the node. The function returns nil when the context is canceled or when fn returns an error.
func (*LocalClient) Validators ¶
type MaybePartialError ¶ added in v0.71.0
type OfferSnapshotHandler ¶ added in v0.73.0
type OfferSnapshotHandler func(context.Context, *types.RequestOfferSnapshot) (*types.ResponseOfferSnapshot, error)
ABCI hooks.
type OnBeginBlockHandler ¶
ABCI hooks.
type OnCheckTxHandler ¶
type OnCheckTxHandler func(context.Context, *types.RequestCheckTx, Tx) (context.Context, *types.ResponseCheckTx)
ABCI hooks.
type OnEndBlockHandler ¶
type OnEndBlockHandler func(blockHeight uint64) (types.ValidatorUpdates, types1.ConsensusParams)
ABCI hooks.
type OnInitChainHandler ¶
type OnInitChainHandler func(*types.RequestInitChain) (*types.ResponseInitChain, error)
ABCI hooks.
type PrepareProposalHandler ¶ added in v0.74.0
ABCI hooks.
type ProcessProposalHandler ¶ added in v0.74.0
ABCI hooks.
type SnapshotEngine ¶
type SnapshotEngine interface {
AddProviders(provs ...types.StateProvider)
}
type TmNode ¶
type TmNode struct { MempoolSize int64 // contains filtered or unexported fields }
func NewTmNode ¶
func NewTmNode( conf blockchain.Config, log *logging.Logger, homeDir string, app types.Application, genesisDoc *tmtypes.GenesisDoc, ) (*TmNode, error)
func (*TmNode) GetClient ¶
func (t *TmNode) GetClient() (*LocalClient, error)
func (*TmNode) ReloadConf ¶
func (*TmNode) ReloadConf(cfg blockchain.Config)