mirror of
https://github.com/corda/corda.git
synced 2025-04-14 14:37:22 +00:00
Add a reified inlined variant of WalletService.linearHeadsOfType
This commit is contained in:
parent
e91872b78d
commit
a41524fc6a
@ -95,6 +95,18 @@ interface WalletService {
|
||||
fun notify(tx: WireTransaction): Wallet = notifyAll(listOf(tx))
|
||||
}
|
||||
|
||||
// TODO: Document this
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
inline fun <reified T : LinearState> WalletService.linearHeadsOfType(): Map<SecureHash, StateAndRef<T>> {
|
||||
return linearHeads.mapNotNull {
|
||||
val s = it.value.state
|
||||
if (s is T)
|
||||
Pair(it.key, it.value as StateAndRef<T>)
|
||||
else
|
||||
null
|
||||
}.toMap()
|
||||
}
|
||||
|
||||
/**
|
||||
* The KMS is responsible for storing and using private keys to sign things. An implementation of this may, for example,
|
||||
* call out to a hardware security module that enforces various auditing and frequency-of-use requirements.
|
||||
|
Loading…
x
Reference in New Issue
Block a user