Skip to content

Commit

Permalink
[FAIL] Adjust ModelSpec.updateUTxO to account for script validation.
Browse files Browse the repository at this point in the history
We fix the testing function `updateUTxO` to spend the correct set of
inputs, based on whether or not the transaction is marked as having
failed script validation.

On its own, this commit is not enough to fix `ModelSpec` tests that use
the test blockchain.
  • Loading branch information
jonathanknowles committed Jun 21, 2022
1 parent 99e5139 commit 461f068
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/core/test/unit/Cardano/Wallet/Primitive/ModelSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,15 @@ updateUTxO !b utxo = do
let txs = Set.fromList $ transactions b
utxo' <- (foldMap utxoFromTx txs `restrictedTo`) . Set.map snd
<$> state (txOutsOurs txs)
return $ (utxo <> utxo') `excluding` txIns txs
return $
(utxo <> utxo') `excluding` foldMap (Set.fromList . inputsToSpend) txs
where
inputsToSpend :: Tx -> [TxIn]
inputsToSpend tx
| txScriptInvalid tx =
collateralInputs tx
| otherwise =
inputs tx

-- | Return all transaction outputs that are ours. This plays well within a
-- 'State' monad.
Expand Down

0 comments on commit 461f068

Please sign in to comment.