You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
771 B

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