From 3380423825a9813bf7eef4d63d8cc4ebfa77e75a Mon Sep 17 00:00:00 2001 From: umi <9@umi.cat> Date: Sat, 22 Jun 2024 18:30:00 +0800 Subject: [PATCH] add hash check in transaction unmarshalling --- core/types/transaction_marshalling.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/types/transaction_marshalling.go b/core/types/transaction_marshalling.go index 4d5b2bcdd4..dbf6534f4a 100644 --- a/core/types/transaction_marshalling.go +++ b/core/types/transaction_marshalling.go @@ -416,6 +416,9 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error { // Now set the inner transaction. tx.setDecoded(inner, 0) - // TODO: check hash here? + if dec.Hash != tx.Hash() { + return errors.New("hash mismatch") + } + return nil }