@@ -56,7 +56,14 @@ type AlonzoBlock struct {
5656}
5757
5858func (b * AlonzoBlock ) UnmarshalCBOR (cborData []byte ) error {
59- return b .UnmarshalCbor (cborData , b )
59+ type tAlonzoBlock AlonzoBlock
60+ var tmp tAlonzoBlock
61+ if _ , err := cbor .Decode (cborData , & tmp ); err != nil {
62+ return err
63+ }
64+ * b = AlonzoBlock (tmp )
65+ b .SetCbor (cborData )
66+ return nil
6067}
6168
6269func (AlonzoBlock ) Type () int {
@@ -166,7 +173,14 @@ type AlonzoTransactionBody struct {
166173}
167174
168175func (b * AlonzoTransactionBody ) UnmarshalCBOR (cborData []byte ) error {
169- return b .UnmarshalCbor (cborData , b )
176+ type tAlonzoTransactionBody AlonzoTransactionBody
177+ var tmp tAlonzoTransactionBody
178+ if _ , err := cbor .Decode (cborData , & tmp ); err != nil {
179+ return err
180+ }
181+ * b = AlonzoTransactionBody (tmp )
182+ b .SetCbor (cborData )
183+ return nil
170184}
171185
172186func (b * AlonzoTransactionBody ) Inputs () []common.TransactionInput {
@@ -255,8 +269,6 @@ type AlonzoTransactionOutput struct {
255269}
256270
257271func (o * AlonzoTransactionOutput ) UnmarshalCBOR (cborData []byte ) error {
258- // Save original CBOR
259- o .SetCbor (cborData )
260272 // Try to parse as legacy mary.Mary output first
261273 var tmpOutput mary.MaryTransactionOutput
262274 if _ , err := cbor .Decode (cborData , & tmpOutput ); err == nil {
@@ -265,8 +277,15 @@ func (o *AlonzoTransactionOutput) UnmarshalCBOR(cborData []byte) error {
265277 o .OutputAmount = tmpOutput .OutputAmount
266278 o .legacyOutput = true
267279 } else {
268- return cbor .DecodeGeneric (cborData , o )
280+ type tAlonzoTransactionOutput AlonzoTransactionOutput
281+ var tmp tAlonzoTransactionOutput
282+ if _ , err := cbor .Decode (cborData , & tmp ); err != nil {
283+ return err
284+ }
285+ * o = AlonzoTransactionOutput (tmp )
269286 }
287+ // Save original CBOR
288+ o .SetCbor (cborData )
270289 return nil
271290}
272291
@@ -391,7 +410,14 @@ type AlonzoTransactionWitnessSet struct {
391410}
392411
393412func (w * AlonzoTransactionWitnessSet ) UnmarshalCBOR (cborData []byte ) error {
394- return w .UnmarshalCbor (cborData , w )
413+ type tAlonzoTransactionWitnessSet AlonzoTransactionWitnessSet
414+ var tmp tAlonzoTransactionWitnessSet
415+ if _ , err := cbor .Decode (cborData , & tmp ); err != nil {
416+ return err
417+ }
418+ * w = AlonzoTransactionWitnessSet (tmp )
419+ w .SetCbor (cborData )
420+ return nil
395421}
396422
397423func (w AlonzoTransactionWitnessSet ) Vkey () []common.VkeyWitness {
@@ -437,8 +463,15 @@ type AlonzoTransaction struct {
437463 TxMetadata * cbor.LazyValue
438464}
439465
440- func (t * AlonzoTransaction ) UnmarshalCBOR (data []byte ) error {
441- return t .UnmarshalCbor (data , t )
466+ func (t * AlonzoTransaction ) UnmarshalCBOR (cborData []byte ) error {
467+ type tAlonzoTransaction AlonzoTransaction
468+ var tmp tAlonzoTransaction
469+ if _ , err := cbor .Decode (cborData , & tmp ); err != nil {
470+ return err
471+ }
472+ * t = AlonzoTransaction (tmp )
473+ t .SetCbor (cborData )
474+ return nil
442475}
443476
444477func (AlonzoTransaction ) Type () int {
0 commit comments