github.com/DFWallet/tendermint-cosmos@v0.0.2/test/fuzz/mempool/checktx.go (about)

     1  package checktx
     2  
     3  import (
     4  	"github.com/DFWallet/tendermint-cosmos/abci/example/kvstore"
     5  	"github.com/DFWallet/tendermint-cosmos/config"
     6  	mempl "github.com/DFWallet/tendermint-cosmos/mempool"
     7  	"github.com/DFWallet/tendermint-cosmos/proxy"
     8  )
     9  
    10  var mempool mempl.Mempool
    11  
    12  func init() {
    13  	app := kvstore.NewApplication()
    14  	cc := proxy.NewLocalClientCreator(app)
    15  	appConnMem, _ := cc.NewABCIClient()
    16  	err := appConnMem.Start()
    17  	if err != nil {
    18  		panic(err)
    19  	}
    20  
    21  	cfg := config.DefaultMempoolConfig()
    22  	cfg.Broadcast = false
    23  
    24  	mempool = mempl.NewCListMempool(cfg, appConnMem, 0)
    25  }
    26  
    27  func Fuzz(data []byte) int {
    28  	err := mempool.CheckTx(data, nil, mempl.TxInfo{})
    29  	if err != nil {
    30  		return 0
    31  	}
    32  
    33  	return 1
    34  }