Skip to content

Commit

Permalink
use sdk mempool
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed May 30, 2024
1 parent c68fd46 commit c13f612
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
18 changes: 18 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ type App struct {

invCheckPeriod uint

chPendingTx chan []byte

// keys to access the substores
keys map[string]*storetypes.KVStoreKey
tkeys map[string]*storetypes.TransientStoreKey
Expand Down Expand Up @@ -466,6 +468,7 @@ func New(
tkeys: tkeys,
memKeys: memKeys,
blockProposalHandler: blockProposalHandler,
chPendingTx: make(chan []byte),
}

// init params keeper and subspaces
Expand Down Expand Up @@ -1212,6 +1215,21 @@ func (app *App) RegisterTendermintService(clientCtx client.Context) {
)
}

func (app *App) PendingTxStream() <-chan []byte {
return app.chPendingTx
}

func (app *App) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx {
res := app.BaseApp.CheckTx(req)
if res.Code == 0 && req.Type == abci.CheckTxType_New {
select {
case app.chPendingTx <- req.Tx:
default:
}
}
return res
}

func (app *App) RegisterNodeService(clientCtx client.Context) {
node.RegisterNodeService(clientCtx, app.GRPCQueryRouter())
}
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ require (
replace (
// Use cosmos keyring
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
github.com/cometbft/cometbft => github.com/mmsqe/cometbft v0.37.0-rc3.0.20240522022348-4d00e28bcfec
github.com/cometbft/cometbft-db => github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63
// release/v0.47.x
github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240517084251-5ba20d99ec23
Expand All @@ -251,7 +250,7 @@ replace (
// TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e
github.com/evmos/ethermint => github.com/mmsqe/ethermint v0.6.5-0.20240522022734-81d7d1c6f7dc
github.com/evmos/ethermint => github.com/mmsqe/ethermint v0.6.5-0.20240530055349-d980b89eab00
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA=
github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c=
github.com/cometbft/cometbft v0.37.7-0.20240515092623-8a0f4814d1dc h1:uXdNbzatJAZ+hznHwYU22BePtqqf2VCRssnm7/0DD3M=
github.com/cometbft/cometbft v0.37.7-0.20240515092623-8a0f4814d1dc/go.mod h1:gFGCFXNGDci6tMLemANPGTfU+j4+oH63PjeLe0iIjJk=
github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4=
github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak=
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
Expand Down Expand Up @@ -1166,10 +1168,8 @@ github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjU
github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4=
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/mmsqe/cometbft v0.37.0-rc3.0.20240522022348-4d00e28bcfec h1:o84e+ylSFjwhmtxpqiL9YNtMPXp2c84jwLLSAOXgRwM=
github.com/mmsqe/cometbft v0.37.0-rc3.0.20240522022348-4d00e28bcfec/go.mod h1:gFGCFXNGDci6tMLemANPGTfU+j4+oH63PjeLe0iIjJk=
github.com/mmsqe/ethermint v0.6.5-0.20240522022734-81d7d1c6f7dc h1:2l2edGRledFzcV9/U+7WaWEQobJ1AvJFWZ+9bv/YiQg=
github.com/mmsqe/ethermint v0.6.5-0.20240522022734-81d7d1c6f7dc/go.mod h1:/AJSi8cTL8Pnlr/lKXmcQqy9z9JBsUUC568gedozArE=
github.com/mmsqe/ethermint v0.6.5-0.20240530055349-d980b89eab00 h1:tCIpIXk5dtpUONlVfQ2+TMTc8yxYjE5KK7pqNJ2Ywgw=
github.com/mmsqe/ethermint v0.6.5-0.20240530055349-d980b89eab00/go.mod h1:R/gopCwdgJ6/7T8T3hsX/YaLjpfHdWZoBglTQS1OyMk=
github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU=
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc=
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw=
Expand Down
9 changes: 4 additions & 5 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ schema = 3
version = "v1.0.0"
hash = "sha256-z/0E0NiEGo7zxM7d94ImgUf8P0/KG6hbP9T4Vuym4p0="
[mod."github.com/cometbft/cometbft"]
version = "v0.37.0-rc3.0.20240522022348-4d00e28bcfec"
hash = "sha256-4PHL+1goJV+F8cT/a41l7U6PYp6y2dGuXg2vD0qqAh0="
replaced = "github.com/mmsqe/cometbft"
version = "v0.37.7-0.20240515092623-8a0f4814d1dc"
hash = "sha256-e5IRb9X+IfkcNlG/95JTuv31R7uafdWpP1wWRvg7uSM="
[mod."github.com/cometbft/cometbft-db"]
version = "v0.0.0-20231011055109-57922ac52a63"
hash = "sha256-iLs/FN1be3AcoyhKj2+b5Msqeat9j2ja4acyOs+w+Uk="
Expand Down Expand Up @@ -220,8 +219,8 @@ schema = 3
hash = "sha256-lDIqRLUrXYCb9mmFBY/+WW+ee69+IkxOgqjHVyo4ij0="
replaced = "github.com/crypto-org-chain/go-ethereum"
[mod."github.com/evmos/ethermint"]
version = "v0.6.5-0.20240522022734-81d7d1c6f7dc"
hash = "sha256-OomNb+DfR0MrTQ7zoyoyeG/E3kFvVjlCfu7BM3SwUx8="
version = "v0.6.5-0.20240530055349-d980b89eab00"
hash = "sha256-L6J3nY9ZcCcFLHtQAwkqH/oVgyz2FQvrxafUgi2HUIM="
replaced = "github.com/mmsqe/ethermint"
[mod."github.com/felixge/httpsnoop"]
version = "v1.0.4"
Expand Down

0 comments on commit c13f612

Please sign in to comment.