mirror of
https://github.com/corda/corda.git
synced 2025-06-23 09:25:36 +00:00
Pre-filter states passed to generateSpend()
Pre-filter states passed to generateSpend(), so that requests from the UI to spend cash only ever spend cash with the correct issuer.
This commit is contained in:
@ -173,7 +173,8 @@ class WalletMonitorService(net: MessagingService, val smm: StateMachineManager,
|
|||||||
// TODO: Have some way of restricting this to states the caller controls
|
// TODO: Have some way of restricting this to states the caller controls
|
||||||
try {
|
try {
|
||||||
Cash().generateSpend(builder, Amount(req.pennies, req.tokenDef.product), req.owner,
|
Cash().generateSpend(builder, Amount(req.pennies, req.tokenDef.product), req.owner,
|
||||||
services.walletService.currentWallet.statesOfType<Cash.State>(),
|
// TODO: Move cash state filtering by issuer down to the contract itself
|
||||||
|
services.walletService.currentWallet.statesOfType<Cash.State>().filter { it.state.data.amount.token == req.tokenDef },
|
||||||
setOf(req.tokenDef.issuer.party))
|
setOf(req.tokenDef.issuer.party))
|
||||||
.forEach {
|
.forEach {
|
||||||
val key = services.keyManagementService.keys[it] ?: throw IllegalStateException("Could not find signing key for ${it.toStringShort()}")
|
val key = services.keyManagementService.keys[it] ?: throw IllegalStateException("Could not find signing key for ${it.toStringShort()}")
|
||||||
|
Reference in New Issue
Block a user