@@ -136,6 +136,17 @@ func (h *ByronMainBlockHeader) Era() common.Era {
136136 return EraByron
137137}
138138
139+ func (h * ByronMainBlockHeader ) BlockBodyHash () common.Blake2b256 {
140+ // BodyProof is guaranteed to be common.Blake2b256 for valid Byron blocks
141+ // as per the Cardano Byron era specification
142+ if bodyProof , ok := h .BodyProof .(common.Blake2b256 ); ok {
143+ return bodyProof
144+ }
145+ // Return zero hash instead of panicking to prevent DoS in verification path
146+ // This will cause validation to fail gracefully rather than crash
147+ return common.Blake2b256 {}
148+ }
149+
139150type ByronTransaction struct {
140151 cbor.StructAsArray
141152 cbor.DecodeStoreCbor
@@ -731,6 +742,17 @@ func (h *ByronEpochBoundaryBlockHeader) Era() common.Era {
731742 return EraByron
732743}
733744
745+ func (h * ByronEpochBoundaryBlockHeader ) BlockBodyHash () common.Blake2b256 {
746+ // BodyProof is guaranteed to be common.Blake2b256 for valid Byron blocks
747+ // as per the Cardano Byron era specification
748+ if bodyProof , ok := h .BodyProof .(common.Blake2b256 ); ok {
749+ return bodyProof
750+ }
751+ // Return zero hash instead of panicking to prevent DoS in verification path
752+ // This will cause validation to fail gracefully rather than crash
753+ return common.Blake2b256 {}
754+ }
755+
734756type ByronMainBlock struct {
735757 cbor.StructAsArray
736758 cbor.DecodeStoreCbor
@@ -798,6 +820,10 @@ func (b *ByronMainBlock) Utxorpc() (*utxorpc.Block, error) {
798820 return & utxorpc.Block {}, nil
799821}
800822
823+ func (b * ByronMainBlock ) BlockBodyHash () common.Blake2b256 {
824+ return b .Header ().BlockBodyHash ()
825+ }
826+
801827type ByronEpochBoundaryBlock struct {
802828 cbor.StructAsArray
803829 cbor.DecodeStoreCbor
@@ -863,6 +889,10 @@ func (b *ByronEpochBoundaryBlock) Utxorpc() (*utxorpc.Block, error) {
863889 return & utxorpc.Block {}, nil
864890}
865891
892+ func (b * ByronEpochBoundaryBlock ) BlockBodyHash () common.Blake2b256 {
893+ return b .Header ().BlockBodyHash ()
894+ }
895+
866896func NewByronEpochBoundaryBlockFromCbor (
867897 data []byte ,
868898) (* ByronEpochBoundaryBlock , error ) {
0 commit comments