mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: rename transaction_by_id_no_hash fn (#12783)
This commit is contained in:
@ -667,7 +667,7 @@ mod tests {
|
||||
while let Some((_, body)) = body_cursor.next()? {
|
||||
for tx_id in body.tx_num_range() {
|
||||
let transaction: TransactionSigned = provider
|
||||
.transaction_by_id_no_hash(tx_id)?
|
||||
.transaction_by_id_unhashed(tx_id)?
|
||||
.map(|tx| {
|
||||
TransactionSigned::new_unhashed(tx.transaction, tx.signature)
|
||||
})
|
||||
|
||||
@ -339,11 +339,11 @@ impl<N: ProviderNodeTypes> TransactionsProvider for BlockchainProvider2<N> {
|
||||
self.consistent_provider()?.transaction_by_id(id)
|
||||
}
|
||||
|
||||
fn transaction_by_id_no_hash(
|
||||
fn transaction_by_id_unhashed(
|
||||
&self,
|
||||
id: TxNumber,
|
||||
) -> ProviderResult<Option<TransactionSignedNoHash>> {
|
||||
self.consistent_provider()?.transaction_by_id_no_hash(id)
|
||||
self.consistent_provider()?.transaction_by_id_unhashed(id)
|
||||
}
|
||||
|
||||
fn transaction_by_hash(&self, hash: TxHash) -> ProviderResult<Option<TransactionSigned>> {
|
||||
@ -2588,7 +2588,7 @@ mod tests {
|
||||
),
|
||||
(
|
||||
ONE,
|
||||
transaction_by_id_no_hash,
|
||||
transaction_by_id_unhashed,
|
||||
|block: &SealedBlock, tx_num: TxNumber, _: B256, _: &Vec<Vec<Receipt>>| (
|
||||
tx_num,
|
||||
Some(Into::<TransactionSignedNoHash>::into(
|
||||
|
||||
@ -945,13 +945,13 @@ impl<N: ProviderNodeTypes> TransactionsProvider for ConsistentProvider<N> {
|
||||
)
|
||||
}
|
||||
|
||||
fn transaction_by_id_no_hash(
|
||||
fn transaction_by_id_unhashed(
|
||||
&self,
|
||||
id: TxNumber,
|
||||
) -> ProviderResult<Option<TransactionSignedNoHash>> {
|
||||
self.get_in_memory_or_storage_by_tx(
|
||||
id.into(),
|
||||
|provider| provider.transaction_by_id_no_hash(id),
|
||||
|provider| provider.transaction_by_id_unhashed(id),
|
||||
|tx_index, _, block_state| {
|
||||
Ok(block_state
|
||||
.block_ref()
|
||||
|
||||
@ -433,15 +433,15 @@ impl<N: ProviderNodeTypes> TransactionsProvider for ProviderFactory<N> {
|
||||
)
|
||||
}
|
||||
|
||||
fn transaction_by_id_no_hash(
|
||||
fn transaction_by_id_unhashed(
|
||||
&self,
|
||||
id: TxNumber,
|
||||
) -> ProviderResult<Option<TransactionSignedNoHash>> {
|
||||
self.static_file_provider.get_with_static_file_or_database(
|
||||
StaticFileSegment::Transactions,
|
||||
id,
|
||||
|static_file| static_file.transaction_by_id_no_hash(id),
|
||||
|| self.provider()?.transaction_by_id_no_hash(id),
|
||||
|static_file| static_file.transaction_by_id_unhashed(id),
|
||||
|| self.provider()?.transaction_by_id_unhashed(id),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -1482,14 +1482,14 @@ impl<TX: DbTx + 'static, N: NodeTypes<ChainSpec: EthereumHardforks>> Transaction
|
||||
)
|
||||
}
|
||||
|
||||
fn transaction_by_id_no_hash(
|
||||
fn transaction_by_id_unhashed(
|
||||
&self,
|
||||
id: TxNumber,
|
||||
) -> ProviderResult<Option<TransactionSignedNoHash>> {
|
||||
self.static_file_provider.get_with_static_file_or_database(
|
||||
StaticFileSegment::Transactions,
|
||||
id,
|
||||
|static_file| static_file.transaction_by_id_no_hash(id),
|
||||
|static_file| static_file.transaction_by_id_unhashed(id),
|
||||
|| Ok(self.tx.get::<tables::Transactions>(id)?),
|
||||
)
|
||||
}
|
||||
@ -1497,7 +1497,7 @@ impl<TX: DbTx + 'static, N: NodeTypes<ChainSpec: EthereumHardforks>> Transaction
|
||||
fn transaction_by_hash(&self, hash: TxHash) -> ProviderResult<Option<TransactionSigned>> {
|
||||
if let Some(id) = self.transaction_id(hash)? {
|
||||
Ok(self
|
||||
.transaction_by_id_no_hash(id)?
|
||||
.transaction_by_id_unhashed(id)?
|
||||
.map(|tx| TransactionSigned::new(tx.transaction, tx.signature, hash)))
|
||||
} else {
|
||||
Ok(None)
|
||||
@ -1511,7 +1511,7 @@ impl<TX: DbTx + 'static, N: NodeTypes<ChainSpec: EthereumHardforks>> Transaction
|
||||
) -> ProviderResult<Option<(TransactionSigned, TransactionMeta)>> {
|
||||
let mut transaction_cursor = self.tx.cursor_read::<tables::TransactionBlocks>()?;
|
||||
if let Some(transaction_id) = self.transaction_id(tx_hash)? {
|
||||
if let Some(tx) = self.transaction_by_id_no_hash(transaction_id)? {
|
||||
if let Some(tx) = self.transaction_by_id_unhashed(transaction_id)? {
|
||||
let transaction = TransactionSigned::new(tx.transaction, tx.signature, tx_hash);
|
||||
if let Some(block_number) =
|
||||
transaction_cursor.seek(transaction_id).map(|b| b.map(|(_, bn)| bn))?
|
||||
|
||||
@ -425,11 +425,11 @@ impl<N: ProviderNodeTypes> TransactionsProvider for BlockchainProvider<N> {
|
||||
self.database.transaction_by_id(id)
|
||||
}
|
||||
|
||||
fn transaction_by_id_no_hash(
|
||||
fn transaction_by_id_unhashed(
|
||||
&self,
|
||||
id: TxNumber,
|
||||
) -> ProviderResult<Option<TransactionSignedNoHash>> {
|
||||
self.database.transaction_by_id_no_hash(id)
|
||||
self.database.transaction_by_id_unhashed(id)
|
||||
}
|
||||
|
||||
fn transaction_by_hash(&self, hash: TxHash) -> ProviderResult<Option<TransactionSigned>> {
|
||||
|
||||
@ -221,7 +221,7 @@ impl<N: NodePrimitives> TransactionsProvider for StaticFileJarProvider<'_, N> {
|
||||
.map(|tx| tx.with_hash()))
|
||||
}
|
||||
|
||||
fn transaction_by_id_no_hash(
|
||||
fn transaction_by_id_unhashed(
|
||||
&self,
|
||||
num: TxNumber,
|
||||
) -> ProviderResult<Option<TransactionSignedNoHash>> {
|
||||
|
||||
@ -1463,12 +1463,12 @@ impl<N: NodePrimitives> TransactionsProvider for StaticFileProvider<N> {
|
||||
})
|
||||
}
|
||||
|
||||
fn transaction_by_id_no_hash(
|
||||
fn transaction_by_id_unhashed(
|
||||
&self,
|
||||
num: TxNumber,
|
||||
) -> ProviderResult<Option<TransactionSignedNoHash>> {
|
||||
self.get_segment_provider_from_transaction(StaticFileSegment::Transactions, num, None)
|
||||
.and_then(|provider| provider.transaction_by_id_no_hash(num))
|
||||
.and_then(|provider| provider.transaction_by_id_unhashed(num))
|
||||
.or_else(|err| {
|
||||
if let ProviderError::MissingStaticFileTx(_, _) = err {
|
||||
Ok(None)
|
||||
@ -1541,7 +1541,7 @@ impl<N: NodePrimitives> TransactionsProvider for StaticFileProvider<N> {
|
||||
}
|
||||
|
||||
fn transaction_sender(&self, id: TxNumber) -> ProviderResult<Option<Address>> {
|
||||
Ok(self.transaction_by_id_no_hash(id)?.and_then(|tx| tx.recover_signer()))
|
||||
Ok(self.transaction_by_id_unhashed(id)?.and_then(|tx| tx.recover_signer()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -263,7 +263,7 @@ impl TransactionsProvider for MockEthProvider {
|
||||
Ok(transaction)
|
||||
}
|
||||
|
||||
fn transaction_by_id_no_hash(
|
||||
fn transaction_by_id_unhashed(
|
||||
&self,
|
||||
id: TxNumber,
|
||||
) -> ProviderResult<Option<TransactionSignedNoHash>> {
|
||||
|
||||
@ -200,7 +200,7 @@ impl TransactionsProvider for NoopProvider {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
fn transaction_by_id_no_hash(
|
||||
fn transaction_by_id_unhashed(
|
||||
&self,
|
||||
_id: TxNumber,
|
||||
) -> ProviderResult<Option<TransactionSignedNoHash>> {
|
||||
|
||||
@ -31,7 +31,7 @@ pub trait TransactionsProvider: BlockNumReader + Send + Sync {
|
||||
fn transaction_by_id(&self, id: TxNumber) -> ProviderResult<Option<TransactionSigned>>;
|
||||
|
||||
/// Get transaction by id without computing the hash.
|
||||
fn transaction_by_id_no_hash(
|
||||
fn transaction_by_id_unhashed(
|
||||
&self,
|
||||
id: TxNumber,
|
||||
) -> ProviderResult<Option<TransactionSignedNoHash>>;
|
||||
|
||||
Reference in New Issue
Block a user