package checktx
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/tendermint/tendermint/abci/example/kvstore"
|
|
"github.com/tendermint/tendermint/config"
|
|
"github.com/tendermint/tendermint/mempool"
|
|
mempoolv0 "github.com/tendermint/tendermint/mempool/v0"
|
|
"github.com/tendermint/tendermint/proxy"
|
|
)
|
|
|
|
var mp mempool.Mempool
|
|
|
|
func init() {
|
|
app := kvstore.NewApplication()
|
|
cc := proxy.NewLocalClientCreator(app)
|
|
appConnMem, _ := cc.NewABCIClient()
|
|
err := appConnMem.Start()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
cfg := config.DefaultMempoolConfig()
|
|
cfg.Broadcast = false
|
|
|
|
mp = mempoolv0.NewCListMempool(cfg, appConnMem, 0)
|
|
}
|
|
|
|
func Fuzz(data []byte) int {
|
|
err := mp.CheckTx(context.Background(), data, nil, mempool.TxInfo{})
|
|
if err != nil {
|
|
return 0
|
|
}
|
|
|
|
return 1
|
|
}
|