Skip to content

Commit

Permalink
chore: remove no hash usage in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Nov 22, 2024
1 parent 3384c84 commit 1911f04
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crates/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1995,7 +1995,7 @@ pub mod serde_bincode_compat {
mod tests {
use crate::{
transaction::{TxEip1559, TxKind, TxLegacy},
Transaction, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash,
Transaction, TransactionSigned, TransactionSignedEcRecovered,
};
use alloy_consensus::Transaction as _;
use alloy_eips::eip2718::{Decodable2718, Encodable2718};
Expand Down Expand Up @@ -2378,17 +2378,17 @@ mod tests {
input: Bytes::from(input),
});

let tx_signed_no_hash = TransactionSignedNoHash { signature, transaction };
test_transaction_signed_to_from_compact(tx_signed_no_hash);
let tx = TransactionSigned::new_unhashed(transaction, signature);
test_transaction_signed_to_from_compact(tx);
}
}

fn test_transaction_signed_to_from_compact(tx_signed_no_hash: TransactionSignedNoHash) {
fn test_transaction_signed_to_from_compact(tx: TransactionSigned) {
// zstd aware `to_compact`
let mut buff: Vec<u8> = Vec::new();
let written_bytes = tx_signed_no_hash.to_compact(&mut buff);
let (decoded, _) = TransactionSignedNoHash::from_compact(&buff, written_bytes);
assert_eq!(tx_signed_no_hash, decoded);
let written_bytes = tx.to_compact(&mut buff);
let (decoded, _) = TransactionSigned::from_compact(&buff, written_bytes);
assert_eq!(tx, decoded);
}

#[test]
Expand Down

0 comments on commit 1911f04

Please sign in to comment.