Skip to content

Commit

Permalink
fix: enforce correct parity for legacy transactions (alloy-rs#1428)
Browse files Browse the repository at this point in the history
  • Loading branch information
klkvr authored Oct 3, 2024
1 parent a17aad0 commit a173307
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/consensus/src/transaction/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,12 @@ impl SignableTransaction<Signature> for TxLegacy {
}

fn into_signed(self, signature: Signature) -> Signed<Self> {
// Enforce correct parity for legacy transactions (EIP-155, 27 or 28).
let signature = if let Parity::Parity(parity) = signature.v() {
signature.with_parity(Parity::NonEip155(parity))
} else {
signature
};
let mut buf = Vec::with_capacity(self.encoded_len_with_signature(&signature));
self.encode_with_signature_fields(&signature, &mut buf);
let hash = keccak256(&buf);
Expand Down

0 comments on commit a173307

Please sign in to comment.