@@ -56,7 +56,14 @@ type AlonzoBlock struct {
56
56
}
57
57
58
58
func (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
60
67
}
61
68
62
69
func (AlonzoBlock ) Type () int {
@@ -166,7 +173,14 @@ type AlonzoTransactionBody struct {
166
173
}
167
174
168
175
func (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
170
184
}
171
185
172
186
func (b * AlonzoTransactionBody ) Inputs () []common.TransactionInput {
@@ -255,8 +269,6 @@ type AlonzoTransactionOutput struct {
255
269
}
256
270
257
271
func (o * AlonzoTransactionOutput ) UnmarshalCBOR (cborData []byte ) error {
258
- // Save original CBOR
259
- o .SetCbor (cborData )
260
272
// Try to parse as legacy mary.Mary output first
261
273
var tmpOutput mary.MaryTransactionOutput
262
274
if _ , err := cbor .Decode (cborData , & tmpOutput ); err == nil {
@@ -265,8 +277,15 @@ func (o *AlonzoTransactionOutput) UnmarshalCBOR(cborData []byte) error {
265
277
o .OutputAmount = tmpOutput .OutputAmount
266
278
o .legacyOutput = true
267
279
} 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 )
269
286
}
287
+ // Save original CBOR
288
+ o .SetCbor (cborData )
270
289
return nil
271
290
}
272
291
@@ -391,7 +410,14 @@ type AlonzoTransactionWitnessSet struct {
391
410
}
392
411
393
412
func (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
395
421
}
396
422
397
423
func (w AlonzoTransactionWitnessSet ) Vkey () []common.VkeyWitness {
@@ -437,8 +463,15 @@ type AlonzoTransaction struct {
437
463
TxMetadata * cbor.LazyValue
438
464
}
439
465
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
442
475
}
443
476
444
477
func (AlonzoTransaction ) Type () int {
0 commit comments