Skip to content

Commit

Permalink
Fix tx from field not being assigned during parse
Browse files Browse the repository at this point in the history
  • Loading branch information
rileystephens28 committed Apr 6, 2024
1 parent 1dcc2ee commit 6c66869
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src.ts/transaction/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "../utils/index.js";

import { accessListify } from "./accesslist.js";
import { computeAddress } from "./address.js";
import { computeAddress, recoverAddress } from "./address.js";

import type { BigNumberish, BytesLike } from "../utils/index.js";
import type { SignatureLike } from "../crypto/index.js";
Expand Down Expand Up @@ -144,6 +144,9 @@ function _parse(data: Uint8Array): TransactionLike {

tx.hash = getTransactionHash(tx, data);

// Compute the sender address since it's not included in the transaction
tx.from = recoverAddress(tx.hash, tx.signature!);

return tx;
}

Expand Down Expand Up @@ -595,6 +598,7 @@ export class Transaction implements TransactionLike<string> {
if (tx.from != null) {
// assertArgument(result.isSigned(), "unsigned transaction cannot define from", "tx", tx);
assertArgument(result.from.toLowerCase() === (tx.from || "").toLowerCase(), "from mismatch", "tx", tx);
result.from = tx.from;
}
return result;
}
Expand Down

0 comments on commit 6c66869

Please sign in to comment.