Skip to content

Commit

Permalink
Speedy: check contract type after checking if they are consumed (digi…
Browse files Browse the repository at this point in the history
…tal-asset#12691)

Missed in digital-asset#12527.

CHANGELOG_BEGIN
CHANGELOG_END
  • Loading branch information
remyhaemmerle-da authored Feb 1, 2022
1 parent 183f936 commit aa2494f
Show file tree
Hide file tree
Showing 3 changed files with 189 additions and 178 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1032,11 +1032,11 @@ private[lf] object SBuiltin {
val coid = getSContractId(args, 0)
onLedger.cachedContracts.get(coid) match {
case Some(cached) =>
if (cached.templateId != templateId)
throw SErrorDamlException(IE.WronglyTypedContract(coid, templateId, cached.templateId))
onLedger.ptx.consumedBy
.get(coid)
.foreach(nid => throw SErrorDamlException(IE.ContractNotActive(coid, templateId, nid)))
if (cached.templateId != templateId)
throw SErrorDamlException(IE.WronglyTypedContract(coid, templateId, cached.templateId))
machine.returnValue = cached.value
case None =>
throw SpeedyHungry(
Expand Down
Loading

0 comments on commit aa2494f

Please sign in to comment.