Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatumSource struct makes the script input to be reference input #650

Closed
jmagan opened this issue Oct 4, 2023 · 0 comments
Closed

DatumSource struct makes the script input to be reference input #650

jmagan opened this issue Oct 4, 2023 · 0 comments

Comments

@jmagan
Copy link

jmagan commented Oct 4, 2023

Hello

I'm facing some troubles when I'm trying to build a transaction. The script UTxO has an inline datum and I'm using txInputsBuilder.add_plutus_script_input. The datum is created as DatumSource::RefInput(input). Maybe I'm wrong, but I understand that when I create a datum as ref, I'm really indicating an inline datum not a reference input.

This DatumSourceis pattern matched in the get_ref_inputs:

pub fn get_ref_inputs(&self) -> TransactionInputs {
        let mut inputs = Vec::new();
        for wintess in self.required_witnesses.scripts.iter()
            .flat_map(|(_, tx_wits)| tx_wits.values())
            .filter_map(|wit| wit.as_ref()) {
            match wintess {
                ScriptWitnessType::NativeScriptWitness(NativeScriptSourceEnum::RefInput(input, _, _)) => {
                    inputs.push(input.clone());
                },
                ScriptWitnessType::PlutusScriptWitness(plutus_witness) => {
                    if let Some(DatumSourceEnum::RefInput(input)) = &plutus_witness.datum {
                        inputs.push(input.clone());
                    }
                    if let PlutusScriptSourceEnum::RefInput(input, _, _) = &plutus_witness.script {
                        inputs.push(input.clone());
                    }
                },
                _ => ()
            }
        }
        TransactionInputs(inputs)
    }

This is causing that my redeemer is adding for each inline datum a refence input. That makes fail my validator. Am I correctly understanding this DatumSource struct? How should I add Plutus Witnesses with inline datum?

By the way, there is a typo in the word witness in the rust script. It's typed as wintess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant