Skip to content

Commit

Permalink
Better error messages for transaction field mismatch (#4659).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Apr 12, 2024
1 parent ec6a754 commit 9230aa0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src.ts/transaction/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1164,12 +1164,12 @@ export class Transaction implements TransactionLike<string> {
if (tx.blobs != null) { result.blobs = tx.blobs; }

if (tx.hash != null) {
assertArgument(result.isSigned(), "unsigned transaction cannot define hash", "tx", tx);
assertArgument(result.isSigned(), "unsigned transaction cannot define '.hash'", "tx", tx);
assertArgument(result.hash === tx.hash, "hash mismatch", "tx", tx);
}

if (tx.from != null) {
assertArgument(result.isSigned(), "unsigned transaction cannot define from", "tx", tx);
assertArgument(result.isSigned(), "unsigned transaction cannot define '.from'", "tx", tx);
assertArgument(result.from.toLowerCase() === (tx.from || "").toLowerCase(), "from mismatch", "tx", tx);
}

Expand Down

0 comments on commit 9230aa0

Please sign in to comment.