From cbe9a7c5cae12e97e53d54f7738852c56e2530d4 Mon Sep 17 00:00:00 2001 From: Querty <98064975+Quertyy@users.noreply.github.com> Date: Sat, 13 Jul 2024 20:05:05 +0200 Subject: [PATCH] refactor: optimize eth_sendTransaction to exit early if signer not found (#9494) --- crates/rpc/rpc-eth-api/src/helpers/transaction.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/rpc/rpc-eth-api/src/helpers/transaction.rs b/crates/rpc/rpc-eth-api/src/helpers/transaction.rs index 73355b47a781..fa4c9be30787 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/transaction.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/transaction.rs @@ -272,6 +272,10 @@ pub trait EthTransactions: LoadTransaction { None => return Err(SignError::NoAccount.into()), }; + if self.find_signer(&from).is_err() { + return Err(SignError::NoAccount.into()); + } + // set nonce if not already set before if request.nonce.is_none() { let nonce = self.transaction_count(from, Some(BlockId::pending())).await?;