Skip to content

Commit

Permalink
fix: TransactionSignedNoHash from_compact() parity on legacy tx
Browse files Browse the repository at this point in the history
  • Loading branch information
leruaa committed Sep 20, 2024
1 parent 83ad37f commit e48a1cc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ impl reth_codecs::Compact for TransactionSignedNoHash {
let bitflags = buf.get_u8() as usize;

let sig_bit = bitflags & 1;
let (signature, buf) = Signature::from_compact(buf, sig_bit);
let (mut signature, buf) = Signature::from_compact(buf, sig_bit);

let zstd_bit = bitflags >> 3;
let (transaction, buf) = if zstd_bit != 0 {
Expand All @@ -1007,6 +1007,12 @@ impl reth_codecs::Compact for TransactionSignedNoHash {
Transaction::from_compact(buf, transaction_type)
};

if matches!(transaction, Transaction::Legacy(_)) {
if let Some(chain_id) = transaction.chain_id() {
signature = signature.with_chain_id(chain_id)
}
}

(Self { signature, transaction }, buf)
}
}
Expand Down

0 comments on commit e48a1cc

Please sign in to comment.