mirror of
https://github.com/corda/corda.git
synced 2025-05-30 14:14:29 +00:00
optimise checkNoDuplicateInputs (#1741)
This commit is contained in:
parent
d15eeaa2b9
commit
f36ca78f88
@ -2,8 +2,8 @@ package net.corda.core.transactions
|
|||||||
|
|
||||||
import net.corda.core.contracts.*
|
import net.corda.core.contracts.*
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
import net.corda.core.internal.indexOfOrThrow
|
|
||||||
import net.corda.core.internal.castIfPossible
|
import net.corda.core.internal.castIfPossible
|
||||||
|
import net.corda.core.internal.indexOfOrThrow
|
||||||
import net.corda.core.internal.uncheckedCast
|
import net.corda.core.internal.uncheckedCast
|
||||||
import java.util.function.Predicate
|
import java.util.function.Predicate
|
||||||
|
|
||||||
@ -34,8 +34,7 @@ abstract class BaseTransaction : NamedByHash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun checkNoDuplicateInputs() {
|
private fun checkNoDuplicateInputs() {
|
||||||
val duplicates = inputs.groupBy { it }.filter { it.value.size > 1 }.keys
|
check(inputs.size == inputs.toSet().size) { "Duplicate input states detected" }
|
||||||
check(duplicates.isEmpty()) { "Duplicate input states detected" }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user