mirror of
https://github.com/corda/corda.git
synced 2024-12-24 15:16:45 +00:00
node: Address review comments
This commit is contained in:
parent
5af0e97444
commit
8e471c6768
@ -63,11 +63,17 @@ class ServerRPCOps(
|
||||
val builder: TransactionBuilder = TransactionType.General.Builder(null)
|
||||
// TODO: Have some way of restricting this to states the caller controls
|
||||
try {
|
||||
Cash().generateSpend(builder, req.amount.withoutIssuer(), req.recipient.owningKey,
|
||||
val vaultCashStates = services.vaultService.currentVault.statesOfType<Cash.State>()
|
||||
// TODO: Move cash state filtering by issuer down to the contract itself
|
||||
services.vaultService.currentVault.statesOfType<Cash.State>().filter { it.state.data.amount.token == req.amount.token },
|
||||
setOf(req.amount.token.issuer.party))
|
||||
.forEach {
|
||||
val cashStatesOfRightCurrency = vaultCashStates.filter { it.state.data.amount.token == req.amount.token }
|
||||
val keysForSigning = Cash().generateSpend(
|
||||
tx = builder,
|
||||
amount = req.amount.withoutIssuer(),
|
||||
to = req.recipient.owningKey,
|
||||
assetsStates = cashStatesOfRightCurrency,
|
||||
onlyFromParties = setOf(req.amount.token.issuer.party)
|
||||
)
|
||||
keysForSigning.forEach {
|
||||
val key = services.keyManagementService.keys[it] ?: throw IllegalStateException("Could not find signing key for ${it.toStringShort()}")
|
||||
builder.signWith(KeyPair(it, key))
|
||||
}
|
||||
|
@ -97,7 +97,8 @@ interface CordaRPCOps : RPCOps {
|
||||
fun verifiedTransactions(): Pair<List<SignedTransaction>, Observable<SignedTransaction>>
|
||||
|
||||
/**
|
||||
* Returns a pair of state machine id - recorded transaction hash pairs
|
||||
* Returns a snapshot list of existing state machine id - recorded transaction hash mappings, and a stream of future
|
||||
* such mappings as well.
|
||||
*/
|
||||
@RPCReturnsObservables
|
||||
fun stateMachineRecordedTransactionMapping(): Pair<List<StateMachineTransactionMapping>, Observable<StateMachineTransactionMapping>>
|
||||
|
Loading…
Reference in New Issue
Block a user