Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(gossip): clearer tx validation explanation #710

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions p2p/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ func NewValidator(logger types.Logger, pusbsubServer *pubsub.Server) *Validator
}

// TxValidator creates a pubsub validator that uses the node's mempool to check the
// transaction. If the transaction is valid, then it is added to the mempool.
// transaction.
// False means the TX is considered invalid and should not be gossiped.
func (v *Validator) TxValidator(mp mempool.Mempool, mpoolIDS *nodemempool.MempoolIDs) GossipValidator {
return func(txMessage *GossipMessage) bool {
v.logger.Debug("transaction received", "bytes", len(txMessage.Data))
Expand All @@ -55,7 +56,7 @@ func (v *Validator) TxValidator(mp mempool.Mempool, mpoolIDS *nodemempool.Mempoo
case errors.Is(err, mempool.ErrTxInCache):
return true
case errors.Is(err, mempool.ErrMempoolIsFull{}):
return true
return true // we have no reason to believe that we should throw away the message
case errors.Is(err, mempool.ErrTxTooLarge{}):
return false
case errors.Is(err, mempool.ErrPreCheck{}):
Expand Down
Loading