From 83d2f8e1d9f1aaa999dec82e2f6b56f23fa15128 Mon Sep 17 00:00:00 2001 From: huangyi Date: Wed, 26 Jun 2024 10:59:08 +0800 Subject: [PATCH] cleanup --- types/mempool/mempool.go | 4 ++++ types/mempool/priority_nonce.go | 4 +--- types/mempool/sender_nonce.go | 4 +--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/mempool/mempool.go b/types/mempool/mempool.go index b3694bb35527..69445e409ca5 100644 --- a/types/mempool/mempool.go +++ b/types/mempool/mempool.go @@ -19,6 +19,10 @@ func NewMempoolTx(tx sdk.Tx, gasWanted uint64) MempoolTx { } } +type GasTx interface { + GetGas() uint64 +} + type Mempool interface { // Insert attempts to insert a Tx into the app-side mempool returning // an error upon failure. diff --git a/types/mempool/priority_nonce.go b/types/mempool/priority_nonce.go index 9d3dcb3951af..6a5524188f0d 100644 --- a/types/mempool/priority_nonce.go +++ b/types/mempool/priority_nonce.go @@ -278,9 +278,7 @@ func (mp *PriorityNonceMempool[C]) InsertWithGasWanted(ctx context.Context, tx s func (mp *PriorityNonceMempool[C]) Insert(ctx context.Context, tx sdk.Tx) error { var gasLimit uint64 - if gasTx, ok := tx.(interface { - GetGas() uint64 - }); ok { + if gasTx, ok := tx.(GasTx); ok { gasLimit = gasTx.GetGas() } diff --git a/types/mempool/sender_nonce.go b/types/mempool/sender_nonce.go index 6609263af3bf..23152173c0d4 100644 --- a/types/mempool/sender_nonce.go +++ b/types/mempool/sender_nonce.go @@ -157,9 +157,7 @@ func (snm *SenderNonceMempool) InsertWithGasWanted(_ context.Context, tx sdk.Tx, func (mp *SenderNonceMempool) Insert(ctx context.Context, tx sdk.Tx) error { var gasLimit uint64 - if gasTx, ok := tx.(interface { - GetGas() uint64 - }); ok { + if gasTx, ok := tx.(GasTx); ok { gasLimit = gasTx.GetGas() }