Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Jun 26, 2024
1 parent 659cdf6 commit bbe2331
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions types/mempool/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

type MempoolTx struct {
type Tx struct {
Tx sdk.Tx
GasWanted uint64
}

func NewMempoolTx(tx sdk.Tx, gasWanted uint64) MempoolTx {
return MempoolTx{
func NewMempoolTx(tx sdk.Tx, gasWanted uint64) Tx {
return Tx{
Tx: tx,
GasWanted: gasWanted,
}
Expand Down Expand Up @@ -53,7 +53,7 @@ type Iterator interface {
Next() Iterator

// Tx returns the transaction at the current position of the iterator.
Tx() MempoolTx
Tx() Tx
}

var (
Expand Down
10 changes: 5 additions & 5 deletions types/mempool/priority_nonce.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (mp *PriorityNonceMempool[C]) NextSenderTx(sender string) sdk.Tx {
}

cursor := senderIndex.Front()
return cursor.Value.(MempoolTx).Tx
return cursor.Value.(Tx).Tx
}

// Insert attempts to insert a Tx into the app-side mempool in O(log n) time,
Expand Down Expand Up @@ -245,12 +245,12 @@ func (mp *PriorityNonceMempool[C]) InsertWithGasWanted(ctx context.Context, tx s
// changes.
sk := txMeta[C]{nonce: nonce, sender: sender}
if oldScore, txExists := mp.scores[sk]; txExists {
if mp.cfg.TxReplacement != nil && !mp.cfg.TxReplacement(oldScore.priority, priority, senderIndex.Get(key).Value.(MempoolTx).Tx, tx) {
if mp.cfg.TxReplacement != nil && !mp.cfg.TxReplacement(oldScore.priority, priority, senderIndex.Get(key).Value.(Tx).Tx, tx) {
return fmt.Errorf(
"tx doesn't fit the replacement rule, oldPriority: %v, newPriority: %v, oldTx: %v, newTx: %v",
oldScore.priority,
priority,
senderIndex.Get(key).Value.(MempoolTx).Tx,
senderIndex.Get(key).Value.(Tx).Tx,
tx,
)
}
Expand Down Expand Up @@ -348,8 +348,8 @@ func (i *PriorityNonceIterator[C]) Next() Iterator {
return i
}

func (i *PriorityNonceIterator[C]) Tx() MempoolTx {
return i.senderCursors[i.sender].Value.(MempoolTx)
func (i *PriorityNonceIterator[C]) Tx() Tx {
return i.senderCursors[i.sender].Value.(Tx)
}

// Select returns a set of transactions from the mempool, ordered by priority
Expand Down
6 changes: 3 additions & 3 deletions types/mempool/sender_nonce.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (snm *SenderNonceMempool) NextSenderTx(sender string) sdk.Tx {
}

cursor := senderIndex.Front()
return cursor.Value.(MempoolTx).Tx
return cursor.Value.(Tx).Tx
}

// Insert adds a tx to the mempool. It returns an error if the tx does not have
Expand Down Expand Up @@ -279,8 +279,8 @@ func (i *senderNonceMempoolIterator) Next() Iterator {
return nil
}

func (i *senderNonceMempoolIterator) Tx() MempoolTx {
return i.currentTx.Value.(MempoolTx)
func (i *senderNonceMempoolIterator) Tx() Tx {
return i.currentTx.Value.(Tx)
}

func removeAtIndex[T any](slice []T, index int) []T {
Expand Down

0 comments on commit bbe2331

Please sign in to comment.