Skip to content

Commit ef12c39

Browse files
Merge pull request ethereum#63 from mdehoog/fix-hash
make Transaction.Hash() invoke SSZ hash for blob txs
2 parents c7541cd + d287418 commit ef12c39

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

core/types/transaction.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,14 @@ func (tx *Transaction) Hash() common.Hash {
497497
}
498498

499499
var h common.Hash
500-
if tx.Type() == LegacyTxType {
500+
switch tx.Type() {
501+
case LegacyTxType:
501502
h = rlpHash(tx.inner)
502-
} else {
503+
case BlobTxType:
504+
// TODO(eip-4844): We should remove this ugly switch by making hash()
505+
// a part of the TxData interface
506+
h = prefixedSSZHash(tx.Type(), &tx.inner.(*SignedBlobTx).Message)
507+
default:
503508
h = prefixedRlpHash(tx.Type(), tx.inner)
504509
}
505510
tx.hash.Store(h)

0 commit comments

Comments
 (0)