Skip to content

Commit

Permalink
doc(gossip): clearer tx validation explanation (#710)
Browse files Browse the repository at this point in the history
  • Loading branch information
danwt authored Apr 18, 2024
1 parent fb0d547 commit 84bb99f
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit 84bb99f

Please sign in to comment.