Merge remote-tracking branch 'remotes/open/master' into merges/june-19-16-47

This commit is contained in:
sollecitom
2018-06-19 16:48:12 +01:00
15 changed files with 195 additions and 33 deletions

View File

@ -15,7 +15,7 @@ class NotaryException(
val error: NotaryError,
/** Id of the transaction to be notarised. Can be _null_ if an error occurred before the id could be resolved. */
val txId: SecureHash? = null
) : FlowException("Unable to notarise transaction${txId ?: " "}: $error")
) : FlowException("Unable to notarise transaction ${txId ?: "<Unknown>"} : $error")
/** Specifies the cause for notarisation request failure. */
@CordaSerializable
@ -27,7 +27,9 @@ sealed class NotaryError {
/** Specifies which states have already been consumed in another transaction. */
val consumedStates: Map<StateRef, StateConsumptionDetails>
) : NotaryError() {
override fun toString() = "One or more input states have been used in another transaction"
override fun toString() = "Conflict notarising transaction $txId. " +
"Input states have been used in another transactions, count: ${consumedStates.size}, " +
"content: ${consumedStates.asSequence().joinToString(limit = 5) { it.key.toString() + "->" + it.value }}"
}
/** Occurs when time specified in the [TimeWindow] command is outside the allowed tolerance. */

View File

@ -95,4 +95,11 @@ sealed class FlowIORequest<out R : Any> {
* Execute the specified [operation], suspend the flow until completion.
*/
data class ExecuteAsyncOperation<T : Any>(val operation: FlowAsyncOperation<T>) : FlowIORequest<T>()
/**
* Indicates that no actual IO request occurred, and the flow should be resumed immediately.
* This is used for performing explicit checkpointing anywhere in a flow.
*/
// TODO: consider using an empty FlowAsyncOperation instead
object ForceCheckpoint : FlowIORequest<Unit>()
}

View File

@ -20,6 +20,7 @@ import net.corda.core.cordapp.Cordapp
import net.corda.core.cordapp.CordappConfig
import net.corda.core.cordapp.CordappContext
import net.corda.core.crypto.*
import net.corda.core.flows.FlowLogic
import net.corda.core.identity.CordaX500Name
import net.corda.core.node.ServicesForResolution
import net.corda.core.serialization.*
@ -525,6 +526,11 @@ fun createCordappContext(cordapp: Cordapp, attachmentId: SecureHash?, classLoade
val PublicKey.hash: SecureHash get() = encoded.sha256()
/** Checks if this flow is an idempotent flow. */
fun Class<out FlowLogic<*>>.isIdempotentFlow(): Boolean {
return IdempotentFlow::class.java.isAssignableFrom(this)
}
/**
* Extension method for providing a sumBy method that processes and returns a Long
*/

View File

@ -10,6 +10,7 @@
package net.corda.core.messaging
import net.corda.core.CordaInternal
import net.corda.core.concurrent.CordaFuture
import net.corda.core.context.InvocationContext
import net.corda.core.contracts.ContractState
@ -209,6 +210,7 @@ interface CordaRPCOps : RPCOps {
*
* TODO This method should be removed once SGX work is finalised and the design of the corresponding API using [FilteredTransaction] can be started
*/
@CordaInternal
@Deprecated("This method is intended only for internal use and will be removed from the public API soon.")
fun internalFindVerifiedTransaction(txnId: SecureHash): SignedTransaction?

View File

@ -10,6 +10,7 @@ import net.corda.testing.core.SerializationEnvironmentRule
import org.junit.Rule
import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
class NotaryExceptionSerializationTest {
@Rule
@ -27,5 +28,6 @@ class NotaryExceptionSerializationTest {
val instanceOnTheOtherSide = instance.serialize().bytes.deserialize<NotaryException>()
assertEquals(instance.error, instanceOnTheOtherSide.error)
assertTrue(instance.error.toString().contains("->"))
}
}