Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
Small refactoring for rpc_to_primitive_block (#966)
Browse files Browse the repository at this point in the history
Small refactoring for rpc_to_primitive_block
  • Loading branch information
tcoratger authored Apr 15, 2024
1 parent 09cf4b7 commit d2128cf
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/models/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,17 @@ pub fn rpc_to_primitive_block(block: reth_rpc_types::Block) -> Result<reth_primi
.into_iter()
.map(|tx| {
let signature = tx.signature.ok_or(EthereumDataFormatError::PrimitiveError)?;
let tx_signed = TransactionSigned::from_transaction_and_signature(
Ok(TransactionSigned::from_transaction_and_signature(
rpc_transaction_to_primitive(tx)?,
reth_primitives::Signature {
r: signature.r,
s: signature.s,
odd_y_parity: signature.y_parity.unwrap_or(reth_rpc_types::Parity(false)).0,
},
);
Ok(tx_signed)
))
})
.collect(),
reth_rpc_types::BlockTransactions::Hashes(_transaction_hashes) => {
return Err(EthereumDataFormatError::PrimitiveError);
}
reth_rpc_types::BlockTransactions::Uncle => {
reth_rpc_types::BlockTransactions::Hashes(_) | reth_rpc_types::BlockTransactions::Uncle => {
return Err(EthereumDataFormatError::PrimitiveError);
}
};
Expand Down

0 comments on commit d2128cf

Please sign in to comment.