问题
In Corda, I am running flow tests using a MockNetwork
. I am trying to retrieve a transaction from one of the nodes' transaction storage using:
node.services.validatedTransactions.getTransaction(signedTx.id)
However, this is throwing the following exception:
com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalStateException: Was expecting to find transaction set on current strand: Thread[main,5,main]
What is the cause of this error?
回答1:
Whenever you need to access a MockNode
's database, you need to do so inside a database transaction:
node.transaction {
node.services.validatedTransactions.getTransaction(signedTx.id)
}
来源:https://stackoverflow.com/questions/53279358/java-lang-illegalstateexception-was-expecting-to-find-transaction-set-on-curren