Moved the transaction context into the RPC call site.

This commit is contained in:
Clinton Alexander
2017-01-30 11:21:01 +00:00
parent 65f5259ac9
commit 65b29a8379
2 changed files with 5 additions and 9 deletions

View File

@ -106,7 +106,9 @@ class CordaRPCOpsImpl(
override fun currentNodeTime(): Instant = Instant.now(services.clock)
override fun uploadFile(dataType: String, name: String?, file: InputStream): String {
val acceptor = services.storageService.uploaders.firstOrNull { it.accepts(dataType) }
return acceptor?.upload(file) ?: throw RuntimeException("Cannot find file upload acceptor for $dataType")
return databaseTransaction(database) {
acceptor?.upload(file) ?: throw RuntimeException("Cannot find file upload acceptor for $dataType")
}
}
override fun partyFromKey(key: CompositeKey) = services.identityService.partyFromKey(key)