diff --git a/node/src/main/scala/com/wavesenterprise/api/http/ApiError.scala b/node/src/main/scala/com/wavesenterprise/api/http/ApiError.scala index 2ae3535..1dadd93 100644 --- a/node/src/main/scala/com/wavesenterprise/api/http/ApiError.scala +++ b/node/src/main/scala/com/wavesenterprise/api/http/ApiError.scala @@ -451,10 +451,12 @@ object ApiError extends IntEnum[ApiError] { override val message: String = s"Contract transaction too big, actual size $wrongSize bytes, expected size $rightSize bytes" } - case class ContractExecutionNotFound(txId: ByteStr) extends ApiError { + case class ContractExecutionNotFound(txId: ByteStr, ignoreSuccessful: Boolean) extends ApiError { override val value: Int = 605 override val code: StatusCode = StatusCodes.NotFound - override val message: String = s"Contract execution result is not found for transaction with txId = '$txId'" + override val message: String = + s"Contract execution result is not found for transaction with txId = '$txId'. ${if (ignoreSuccessful) "Transaction with Success status are ignored" + else ""}" } case class ParticipantNotRegistered(unregisteredAddress: Address) extends ApiError { diff --git a/node/src/main/scala/com/wavesenterprise/api/http/service/ContractsApiService.scala b/node/src/main/scala/com/wavesenterprise/api/http/service/ContractsApiService.scala index 41c06c4..3fdb294 100644 --- a/node/src/main/scala/com/wavesenterprise/api/http/service/ContractsApiService.scala +++ b/node/src/main/scala/com/wavesenterprise/api/http/service/ContractsApiService.scala @@ -105,7 +105,7 @@ class ContractsApiService( def executionStatuses(transactionId: ByteStr): Either[ApiError, Seq[ContractExecutionMessage]] = { messagesCache.get(transactionId) match { case Some(messages) => Right(messages.toSeq.sortBy(_.timestamp)) - case None => Left(ContractExecutionNotFound(transactionId)) + case None => Left(ContractExecutionNotFound(transactionId, messagesCache.settings.ignoreSuccessful)) } } diff --git a/node/src/main/scala/com/wavesenterprise/docker/ContractExecutionMessagesCache.scala b/node/src/main/scala/com/wavesenterprise/docker/ContractExecutionMessagesCache.scala index e4d9563..8121b7b 100644 --- a/node/src/main/scala/com/wavesenterprise/docker/ContractExecutionMessagesCache.scala +++ b/node/src/main/scala/com/wavesenterprise/docker/ContractExecutionMessagesCache.scala @@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit * Cache for [[ContractExecutionMessage]] */ class ContractExecutionMessagesCache( - settings: ContractExecutionMessagesCacheSettings, + val settings: ContractExecutionMessagesCacheSettings, dockerMiningEnabled: Boolean, activePeerConnections: ActivePeerConnections, utx: UtxPool, @@ -43,6 +43,7 @@ class ContractExecutionMessagesCache( def put(txId: ByteStr, message: ContractExecutionMessage): Unit = { saveToCache(txId, message) + log.debug(s"Status execution TX from contract: ${message.status}, Setting ignoreSuccessful: ${settings.ignoreSuccessful}") if (message.status != ContractExecutionStatus.Success || !settings.ignoreSuccessful) activePeerConnections.broadcast(NetworkContractExecutionMessage(message)) } @@ -107,6 +108,7 @@ class ContractExecutionMessagesCache( messages.foreach { case (_, networkMessage @ NetworkContractExecutionMessage(message)) => saveToCache(message.txId, message) + log.debug(s"Status execution TX from contract: ${message.status}, Setting ignoreSuccessful: ${settings.ignoreSuccessful}") if (message.status != ContractExecutionStatus.Success || !settings.ignoreSuccessful) activePeerConnections.writeMsg(networkMessage, channelMatcher) diff --git a/node/src/test/scala/com/wavesenterprise/api/http/ContractsApiRouteSpec.scala b/node/src/test/scala/com/wavesenterprise/api/http/ContractsApiRouteSpec.scala index abbe012..f8d6cc4 100644 --- a/node/src/test/scala/com/wavesenterprise/api/http/ContractsApiRouteSpec.scala +++ b/node/src/test/scala/com/wavesenterprise/api/http/ContractsApiRouteSpec.scala @@ -363,7 +363,7 @@ class ContractsApiRouteSpec extends RouteSpec("/contracts") Get(routePath(s"/status/$notFoundTxId")) ~> route ~> check { status shouldBe StatusCodes.NotFound val response = responseAs[JsObject] - (response \ "message").as[String] shouldBe s"Contract execution result is not found for transaction with txId = '$notFoundTxId'" + (response \ "message").as[String] shouldBe s"Contract execution result is not found for transaction with txId = '$notFoundTxId'. " } }