Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SCP-3305 SCP-3263 fixed Ledger.Constraints.Offchain.updateUtxoIndex
Prior to this commit, `Ledger.Constraints.Offchain.updateUtxoIndex` would discard lookups for inputs that aren't script outputs. However, sometimes it is necessary to include particular public-key `TxIn`s in a transaction, via `Plutus.Contract.Wallet.ExportTx.lookups`: a good example of this is when a `Plutus.Contract.Currency.OneShotCurrency` needs to consume a specified `UTxO` in its minting policy. Even though `Plutus.Constraints.Tx.mustSpendPubKeyOutput` adds a public-key input to the lookups, `updateUtxoIndex` discards that, with the result that it is only by chance that `cardano-wallet` would select that necessary input for the balanced transaction and provide it to Plutus validators. (Note that `cardano-wallet` does not automatically provide the `TxIn` in the partially constructed transaction to validators: it only provides `Cardano.Wallet.PartialTx.inputs` and the inputs it has semi-randomly chosen.) The consequence of all of this is that scripts that require a particular input will randomly fail during balancing in wallets with more than one UTxO. This fix simply adds public-key inputs to the type `Ledger.Constraints.OffChain.ScriptOutput` so that it can also hold public-key inputs. It makes minor adjustments to the chain of functions that pass this into an unbalanced transaction before it is sent to `cardano-wallet`.
- Loading branch information