File tree Expand file tree Collapse file tree 3 files changed +28
-3
lines changed
Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -456,6 +456,13 @@ func MinFeeTx(
456456 return 0 , errors .New ("pparams are not expected type" )
457457 }
458458 txBytes := tx .Cbor ()
459+ if len (txBytes ) == 0 {
460+ var err error
461+ txBytes , err = cbor .Encode (tx )
462+ if err != nil {
463+ return 0 , err
464+ }
465+ }
459466 minFee := uint64 (
460467 (tmpPparams .MinFeeA * uint (len (txBytes ))) + tmpPparams .MinFeeB ,
461468 )
Original file line number Diff line number Diff line change @@ -457,6 +457,13 @@ func MinFeeTx(
457457 return 0 , errors .New ("pparams are not expected type" )
458458 }
459459 txBytes := tx .Cbor ()
460+ if len (txBytes ) == 0 {
461+ var err error
462+ txBytes , err = cbor .Encode (tx )
463+ if err != nil {
464+ return 0 , err
465+ }
466+ }
460467 minFee := uint64 (
461468 (tmpPparams .MinFeeA * uint (len (txBytes ))) + tmpPparams .MinFeeB ,
462469 )
Original file line number Diff line number Diff line change @@ -283,9 +283,13 @@ func UtxoValidateMaxTxSizeUtxo(
283283 if ! ok {
284284 return errors .New ("pparams are not expected type" )
285285 }
286- txBytes , err := cbor .Encode (tx )
287- if err != nil {
288- return err
286+ txBytes := tx .Cbor ()
287+ if len (txBytes ) == 0 {
288+ var err error
289+ txBytes , err = cbor .Encode (tx )
290+ if err != nil {
291+ return err
292+ }
289293 }
290294 if uint (len (txBytes )) <= tmpPparams .MaxTxSize {
291295 return nil
@@ -306,6 +310,13 @@ func MinFeeTx(
306310 return 0 , errors .New ("pparams are not expected type" )
307311 }
308312 txBytes := tx .Cbor ()
313+ if len (txBytes ) == 0 {
314+ var err error
315+ txBytes , err = cbor .Encode (tx )
316+ if err != nil {
317+ return 0 , err
318+ }
319+ }
309320 minFee := uint64 (
310321 (tmpPparams .MinFeeA * uint (len (txBytes ))) + tmpPparams .MinFeeB ,
311322 )
You can’t perform that action at this time.
0 commit comments