From 8baf5cfd386818358616d39ebd7b7f2b6977cb54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Faruk=20Irmak?= Date: Fri, 13 Sep 2024 15:19:28 +0300 Subject: [PATCH 1/4] feat: allow removing txns from pool via CLI/RPC --- eth/api_backend.go | 4 ++++ internal/ethapi/api.go | 5 +++++ internal/ethapi/backend.go | 1 + internal/web3ext/web3ext.go | 5 +++++ 4 files changed, 15 insertions(+) diff --git a/eth/api_backend.go b/eth/api_backend.go index cae5e28efb79..5aee374c3c66 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -266,6 +266,10 @@ func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) return b.eth.txPool.AddLocal(signedTx) } +func (b *EthAPIBackend) RemoveTx(txHash common.Hash) { + b.eth.txPool.RemoveTx(txHash, true) +} + func (b *EthAPIBackend) GetPoolTransactions() (types.Transactions, error) { pending := b.eth.txPool.Pending(false) var txs types.Transactions diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 67bf83af6bfc..9b11f4d31223 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -227,6 +227,11 @@ func (s *PublicTxPoolAPI) Status() map[string]hexutil.Uint { } } +// Remove evicts a transaction from the pool. +func (s *PublicTxPoolAPI) Remove(ctx context.Context, hash common.Hash) { + s.b.RemoveTx(hash) +} + // Inspect retrieves the content of the transaction pool and flattens it into an // easily inspectable list. func (s *PublicTxPoolAPI) Inspect() map[string]map[string]map[string]string { diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go index b2be3ae41a0a..45d595edd51c 100644 --- a/internal/ethapi/backend.go +++ b/internal/ethapi/backend.go @@ -75,6 +75,7 @@ type Backend interface { // Transaction pool API SendTx(ctx context.Context, signedTx *types.Transaction) error + RemoveTx(txHash common.Hash) GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error) GetPoolTransactions() (types.Transactions, error) GetPoolTransaction(txHash common.Hash) *types.Transaction diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index 023c13687144..1198edf17747 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -772,6 +772,11 @@ web3._extend({ call: 'txpool_contentFrom', params: 1, }), + new web3._extend.Method({ + name: 'remove', + call: 'txpool_remove', + params: 1 + }), ] }); ` From 7bf90f973c00fb0bad9e5b7d1e05dbf216c7e082 Mon Sep 17 00:00:00 2001 From: HAOYUatHZ Date: Fri, 13 Sep 2024 13:29:33 +0000 Subject: [PATCH 2/4] =?UTF-8?q?chore:=20auto=20version=20bump=E2=80=89[bot?= =?UTF-8?q?]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- params/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/params/version.go b/params/version.go index eae9a56a9e26..3916379abda9 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ import ( const ( VersionMajor = 5 // Major version component of the current release VersionMinor = 7 // Minor version component of the current release - VersionPatch = 13 // Patch version component of the current release + VersionPatch = 14 // Patch version component of the current release VersionMeta = "mainnet" // Version metadata to append to the version string ) From 0694a61dfaa2877c26a01e682360a16db73ed6e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Faruk=20Irmak?= Date: Mon, 16 Sep 2024 10:41:05 +0300 Subject: [PATCH 3/4] rename --- internal/ethapi/api.go | 4 ++-- internal/web3ext/web3ext.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 9b11f4d31223..b57bc67195f7 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -227,8 +227,8 @@ func (s *PublicTxPoolAPI) Status() map[string]hexutil.Uint { } } -// Remove evicts a transaction from the pool. -func (s *PublicTxPoolAPI) Remove(ctx context.Context, hash common.Hash) { +// RemoveTransactionByHash evicts a transaction from the pool. +func (s *PublicTxPoolAPI) RemoveTransactionByHash(ctx context.Context, hash common.Hash) { s.b.RemoveTx(hash) } diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index 1198edf17747..2967a849b1a1 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -773,8 +773,8 @@ web3._extend({ params: 1, }), new web3._extend.Method({ - name: 'remove', - call: 'txpool_remove', + name: 'removeTransactionByHash', + call: 'txpool_removeTransactionByHash', params: 1 }), ] From 9e0f5878e6bddb18f68aab6733db18af535542d8 Mon Sep 17 00:00:00 2001 From: omerfirmak Date: Mon, 16 Sep 2024 08:05:10 +0000 Subject: [PATCH 4/4] =?UTF-8?q?chore:=20auto=20version=20bump=E2=80=89[bot?= =?UTF-8?q?]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- params/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/params/version.go b/params/version.go index 3916379abda9..7f4b7c582248 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ import ( const ( VersionMajor = 5 // Major version component of the current release VersionMinor = 7 // Minor version component of the current release - VersionPatch = 14 // Patch version component of the current release + VersionPatch = 15 // Patch version component of the current release VersionMeta = "mainnet" // Version metadata to append to the version string )