Documentation ¶
Index ¶
- Constants
- func DeduplicateCurseWords(inWords string) string
- func UpdateOrSetUser(db *model.DB, uname string, toBan bool, txn *badger.Txn) error
- type AppState
- type Config
- type ForumApp
- func (app *ForumApp) CheckTx(_ context.Context, req *abci.CheckTxRequest) (*abci.CheckTxResponse, error)
- func (app *ForumApp) Commit(_ context.Context, _ *abci.CommitRequest) (*abci.CommitResponse, error)
- func (app *ForumApp) ExtendVote(_ context.Context, _ *abci.ExtendVoteRequest) (*abci.ExtendVoteResponse, error)
- func (app *ForumApp) FinalizeBlock(_ context.Context, req *abci.FinalizeBlockRequest) (*abci.FinalizeBlockResponse, error)
- func (app *ForumApp) Info(_ context.Context, info *abci.InfoRequest) (*abci.InfoResponse, error)
- func (app *ForumApp) InitChain(_ context.Context, req *abci.InitChainRequest) (*abci.InitChainResponse, error)
- func (app *ForumApp) PrepareProposal(_ context.Context, req *abci.PrepareProposalRequest) (*abci.PrepareProposalResponse, error)
- func (app *ForumApp) ProcessProposal(_ context.Context, req *abci.ProcessProposalRequest) (*abci.ProcessProposalResponse, error)
- func (app *ForumApp) Query(ctx context.Context, query *abci.QueryRequest) (*abci.QueryResponse, error)
- func (app *ForumApp) VerifyVoteExtension(_ context.Context, req *abci.VerifyVoteExtensionRequest) (*abci.VerifyVoteExtensionResponse, error)
Constants ¶
const ( CodeTypeOK uint32 = 0 CodeTypeEncodingError uint32 = 1 CodeTypeInvalidTxFormat uint32 = 2 CodeTypeBanned uint32 = 3 )
const ApplicationVersion = 1
const CurseWordsLimitVE = 10
Variables ¶
This section is empty.
Functions ¶
func DeduplicateCurseWords ¶
Types ¶
type Config ¶
func LoadConfig ¶
type ForumApp ¶
type ForumApp struct { abci.BaseApplication CurseWords string // contains filtered or unexported fields }
func (*ForumApp) CheckTx ¶
func (app *ForumApp) CheckTx(_ context.Context, req *abci.CheckTxRequest) (*abci.CheckTxResponse, error)
CheckTx handles validation of inbound transactions. If a transaction is not a valid message, or if a user does not exist in the database or if a user is banned it returns an error
func (*ForumApp) Commit ¶
func (app *ForumApp) Commit(_ context.Context, _ *abci.CommitRequest) (*abci.CommitResponse, error)
Commit the application state
func (*ForumApp) ExtendVote ¶
func (app *ForumApp) ExtendVote(_ context.Context, _ *abci.ExtendVoteRequest) (*abci.ExtendVoteResponse, error)
ExtendVote returns curse words as vote extensions
func (*ForumApp) FinalizeBlock ¶
func (app *ForumApp) FinalizeBlock(_ context.Context, req *abci.FinalizeBlockRequest) (*abci.FinalizeBlockResponse, error)
FinalizeBlock Deliver the decided block to the Application
func (*ForumApp) Info ¶
func (app *ForumApp) Info(_ context.Context, info *abci.InfoRequest) (*abci.InfoResponse, error)
Info return application information
func (*ForumApp) InitChain ¶
func (app *ForumApp) InitChain(_ context.Context, req *abci.InitChainRequest) (*abci.InitChainResponse, error)
InitChain initializes the blockchain with information sent from CometBFT such as validators or consensus parameters
func (*ForumApp) PrepareProposal ¶
func (app *ForumApp) PrepareProposal(_ context.Context, req *abci.PrepareProposalRequest) (*abci.PrepareProposalResponse, error)
PrepareProposal is used to prepare a proposal for the next block in the blockchain. The application can re-order, remove or add transactions
func (*ForumApp) ProcessProposal ¶
func (app *ForumApp) ProcessProposal(_ context.Context, req *abci.ProcessProposalRequest) (*abci.ProcessProposalResponse, error)
ProcessProposal validates the proposed block and the transactions and return a status if it was accepted or rejected
func (*ForumApp) Query ¶
func (app *ForumApp) Query(ctx context.Context, query *abci.QueryRequest) (*abci.QueryResponse, error)
Query the application state for specific information
func (*ForumApp) VerifyVoteExtension ¶
func (app *ForumApp) VerifyVoteExtension(_ context.Context, req *abci.VerifyVoteExtensionRequest) (*abci.VerifyVoteExtensionResponse, error)
VerifyVoteExtension verifies the vote extensions and ensure they include the curse words It will not be called for extensions generated by this validator