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
768 B

  1. package v1
  2. import (
  3. "context"
  4. abciclient "github.com/tendermint/tendermint/abci/client"
  5. "github.com/tendermint/tendermint/abci/example/kvstore"
  6. "github.com/tendermint/tendermint/config"
  7. "github.com/tendermint/tendermint/internal/mempool"
  8. mempoolv1 "github.com/tendermint/tendermint/internal/mempool/v0"
  9. )
  10. var mp mempool.Mempool
  11. func init() {
  12. app := kvstore.NewApplication()
  13. cc := abciclient.NewLocalCreator(app)
  14. appConnMem, _ := cc()
  15. err := appConnMem.Start()
  16. if err != nil {
  17. panic(err)
  18. }
  19. cfg := config.DefaultMempoolConfig()
  20. cfg.Broadcast = false
  21. mp = mempoolv1.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. }