@@ -722,7 +722,8 @@ func UtxoValidateScriptDataHash(
722722 }
723723 }
724724
725- // Check scripts in regular inputs
725+ // Check reference scripts on regular inputs.
726+ // These may provide reference scripts for minting, spending, etc.
726727 for _ , input := range tmpTx .Inputs () {
727728 utxo , err := ls .UtxoById (input )
728729 if err != nil {
@@ -745,22 +746,21 @@ func UtxoValidateScriptDataHash(
745746 }
746747 }
747748
748- hasPlutusScripts := len (usedVersions ) > 0
749749 declaredHash := tx .ScriptDataHash ()
750750
751- // If no Plutus scripts and no redeemers/datums, ScriptDataHash should be absent
752- if ! hasPlutusScripts && ! hasRedeemers && ! hasDatums {
751+ // ScriptDataHash is required only when the transaction has redeemers or
752+ // witness datums, indicating actual script execution. The mere presence
753+ // of ScriptRefs in consumed/referenced UTxOs does NOT require a hash —
754+ // they are inert data unless matched by a redeemer.
755+ if ! hasRedeemers && ! hasDatums {
753756 if declaredHash != nil {
754757 return common.ExtraneousScriptDataHashError {Provided : * declaredHash }
755758 }
756759 return nil
757760 }
758761
759- // If there are Plutus scripts/redeemers/datums, ScriptDataHash is required
760- if hasPlutusScripts || hasRedeemers || hasDatums {
761- if declaredHash == nil {
762- return common.MissingScriptDataHashError {}
763- }
762+ if declaredHash == nil {
763+ return common.MissingScriptDataHashError {}
764764 }
765765
766766 // Verify cost models are present for all used Plutus versions
@@ -1903,7 +1903,10 @@ func UtxoValidatePlutusScripts(
19031903 for _ , input := range tx .Inputs () {
19041904 utxo , err := ls .UtxoById (input )
19051905 if err != nil {
1906- continue
1906+ return common.InputResolutionError {
1907+ Input : input ,
1908+ Err : err ,
1909+ }
19071910 }
19081911 resolvedInputs = append (resolvedInputs , utxo )
19091912 resolvedInputsMap [input .String ()] = utxo
0 commit comments