From ac02f522ad34b637218a3f96dd9a092690876f30 Mon Sep 17 00:00:00 2001 From: rrhlrmrr Date: Fri, 14 Feb 2025 10:32:13 +0900 Subject: [PATCH 1/2] check Hash Here --- core/types/transaction_marshalling.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/types/transaction_marshalling.go b/core/types/transaction_marshalling.go index 1bbb97a3ec..7e08adcea4 100644 --- a/core/types/transaction_marshalling.go +++ b/core/types/transaction_marshalling.go @@ -514,6 +514,11 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error { // Now set the inner transaction. tx.setDecoded(inner, 0) - // TODO: check hash here? + if dec.Hash != (common.Hash{}) { + computedHash := tx.Hash() + if computedHash != dec.Hash { + return errors.New("'Hash'transaction hash mismatch") + } + } return nil } From 630bb0ec667cdafb6679c0b40db282639df9bec1 Mon Sep 17 00:00:00 2001 From: rrhlrmrr Date: Mon, 17 Feb 2025 18:10:27 +0900 Subject: [PATCH 2/2] update the error message --- core/types/transaction_marshalling.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/types/transaction_marshalling.go b/core/types/transaction_marshalling.go index 7e08adcea4..e7033feb83 100644 --- a/core/types/transaction_marshalling.go +++ b/core/types/transaction_marshalling.go @@ -517,7 +517,7 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error { if dec.Hash != (common.Hash{}) { computedHash := tx.Hash() if computedHash != dec.Hash { - return errors.New("'Hash'transaction hash mismatch") + return errors.New("transaction hash mismatch") } } return nil