Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evm fix unconfirmed tx q #173

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion internal/mempool/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ func (txmp *TxMempool) Unlock() {
// Size returns the number of valid transactions in the mempool. It is
// thread-safe.
func (txmp *TxMempool) Size() int {
return txmp.txStore.Size() + txmp.pendingTxs.Size()
txSize := txmp.txStore.Size()
pendingSize := txmp.pendingTxs.Size()
return txSize + pendingSize
}

// SizeBytes return the total sum in bytes of all the valid transactions in the
Expand Down
2 changes: 1 addition & 1 deletion internal/mempool/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func (p *PendingTxs) popTxsAtIndices(indices []int) {
newTxs = append(newTxs, p.txs[start:idx]...)
start = idx
}
newTxs = append(newTxs, p.txs[indices[len(indices)-1]:]...)
newTxs = append(newTxs, p.txs[start+1:]...)
p.txs = newTxs
}

Expand Down
2 changes: 0 additions & 2 deletions internal/rpc/core/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ func (env *Environment) BroadcastTxCommit(ctx context.Context, req *coretypes.Re
// More: https://docs.tendermint.com/master/rpc/#/Info/unconfirmed_txs
func (env *Environment) UnconfirmedTxs(ctx context.Context, req *coretypes.RequestUnconfirmedTxs) (*coretypes.ResultUnconfirmedTxs, error) {
totalCount := env.Mempool.Size()
fmt.Printf("EVMTEST mempool size: %d\n", totalCount)
perPage := env.validatePerPage(req.PerPage.IntPtr())
page, err := validatePage(req.Page.IntPtr(), perPage, totalCount)
if err != nil {
Expand All @@ -160,7 +159,6 @@ func (env *Environment) UnconfirmedTxs(ctx context.Context, req *coretypes.Reque
txs := env.Mempool.ReapMaxTxs(skipCount + tmmath.MinInt(perPage, totalCount-skipCount))
result := txs[skipCount:]

fmt.Printf("EVMTEST unconfirmed tx result count: %d, skipping %d\n", len(result), skipCount)
return &coretypes.ResultUnconfirmedTxs{
Count: len(result),
Total: totalCount,
Expand Down
Loading