Skip to content

Commit 3305710

Browse files
committed
Add comment explaining why we use the inequality check <= instead of ==
1 parent cf0af8a commit 3305710

File tree

1 file changed

+4
-0
lines changed
  • cardano-api/test/cardano-api-test/Test/Cardano/Api

1 file changed

+4
-0
lines changed

cardano-api/test/cardano-api-test/Test/Cardano/Api/TxBody.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ prop_simple_script_witness_count = H.property $ do
133133
<$> genTxIn
134134
witList <- H.forAll $ satisfyScript script
135135
let witCount = fromIntegral $ Set.size witList
136+
-- We use the inequality @<=@ instead of @==@ because 'estimateTransactionKeyWitnessCount'
137+
-- calculates an upper bound on the number of key witnesses required to validate a transaction,
138+
-- and the @witList@ contains a random subset that can potentially be used to satisfy the script.
139+
-- So we only know it must be smaller or equal to the upper bound.
136140
H.diff
137141
(estimateTransactionKeyWitnessCount contentWithoutScript + witCount)
138142
(<=)

0 commit comments

Comments
 (0)