File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
pallas-primitives/src/conway Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -536,7 +536,23 @@ where
536536 fn decode ( d : & mut minicbor:: Decoder < ' b > , ctx : & mut C ) -> Result < Self , minicbor:: decode:: Error > {
537537 match d. datatype ( ) ? {
538538 minicbor:: data:: Type :: Array | minicbor:: data:: Type :: ArrayIndef => {
539- Ok ( PseudoTransactionOutput :: Legacy ( d. decode_with ( ctx) ?) )
539+ let output: LegacyTransactionOutput = d. decode_with ( ctx) ?;
540+
541+ // this workaround is done to match the behavior of the Cardano node decoding
542+ // https://github.com/IntersectMBO/cardano-ledger/blob/957370a635805005252f905a9e36fbd53a5e39a8/eras/mary/impl/src/Cardano/Ledger/Mary/Value.hs#L329
543+ if let babbage:: Value :: Multiasset ( _, kv) = & output. amount {
544+ for ( _, assets) in kv. iter ( ) {
545+ for ( _, amount) in assets. iter ( ) {
546+ if * amount == 0 {
547+ return Err ( minicbor:: decode:: Error :: message (
548+ "MultiAsset cannot contain zeros" ,
549+ ) ) ;
550+ }
551+ }
552+ }
553+ }
554+
555+ Ok ( PseudoTransactionOutput :: Legacy ( output) )
540556 }
541557 minicbor:: data:: Type :: Map | minicbor:: data:: Type :: MapIndef => {
542558 Ok ( PseudoTransactionOutput :: PostAlonzo ( d. decode_with ( ctx) ?) )
You can’t perform that action at this time.
0 commit comments