Better error messages for transaction field mismatch (#4659).
This commit is contained in:
parent
ec6a754f0c
commit
9230aa0b9a
@ -1164,12 +1164,12 @@ export class Transaction implements TransactionLike<string> {
|
|||||||
if (tx.blobs != null) { result.blobs = tx.blobs; }
|
if (tx.blobs != null) { result.blobs = tx.blobs; }
|
||||||
|
|
||||||
if (tx.hash != null) {
|
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);
|
assertArgument(result.hash === tx.hash, "hash mismatch", "tx", tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tx.from != null) {
|
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);
|
assertArgument(result.from.toLowerCase() === (tx.from || "").toLowerCase(), "from mismatch", "tx", tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user