Better error messages for transaction field mismatch (#4659).

This commit is contained in:
Richard Moore 2024-04-12 00:09:48 -04:00
parent ec6a754f0c
commit 9230aa0b9a

@ -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);
}