Skip to content

mkSpendOutputsOnlyTx should support reference scripts on key addresses #6522

@Jimbo4350

Description

@Jimbo4350

Summary

mkSpendOutputsOnlyTx in Testnet.Process.Cli.Transaction currently only attaches reference scripts (--tx-out-reference-script-file) to ScriptAddress outputs. The PubKeyAddress branch ignores the Maybe (File ScriptJSON In) parameter entirely.

This means publishing a reference script at a regular payment key address requires building the transaction manually with execCli' instead of using the helper.

Expected behavior

Both PubKeyAddress and ScriptAddress outputs should support the optional reference script attachment.

Current code

computeTxOuts =
    concat <$> sequence
      [ case txOut of
          PubKeyAddress dstWallet ->
            -- reference script parameter is ignored here
            return ["--tx-out", T.unpack (paymentKeyInfoAddr dstWallet) <> "+" ++ show (unCoin amount)]
          ScriptAddress (File referenceScriptJSON) -> do
            ...
            return
              ( ["--tx-out", scriptAddress <> "+" ++ show (unCoin amount)]
                  <> maybe [] (\(File newRefScript) -> ["--tx-out-reference-script-file", newRefScript]) mNewRefScript
              )
      | (txOut, amount, mNewRefScript) <- txOutputs
      ]

Suggested fix

Add the --tx-out-reference-script-file handling to the PubKeyAddress branch as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions