IntersectMBO / IntersectMBO/cardano-node
mkSpendOutputsOnlyTx should support reference scripts on key addresses
- Dominant language
- Haskell
- Stars
- 3.2k
- Forks
- 754
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 20
Description
## 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
```haskell
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.
Contributor guide
Assessment
This issue has not been assessed yet.