From af1dbf4c6d8cb71c0549ca22a729dea919601966 Mon Sep 17 00:00:00 2001 From: Ulrik Rasmussen Date: Thu, 28 Apr 2022 11:35:33 +0200 Subject: [PATCH] Do not emit warning when StatePointer.isResolved = false The warning is misleading because it is emitted in the case where the ServiceHub reference is not null but one or more state pointers were configured to not be automatically resolved by the transaction builder. --- .../net/corda/core/transactions/TransactionBuilder.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/main/kotlin/net/corda/core/transactions/TransactionBuilder.kt b/core/src/main/kotlin/net/corda/core/transactions/TransactionBuilder.kt index 71fb6c728b..c05f378223 100644 --- a/core/src/main/kotlin/net/corda/core/transactions/TransactionBuilder.kt +++ b/core/src/main/kotlin/net/corda/core/transactions/TransactionBuilder.kt @@ -741,9 +741,11 @@ open class TransactionBuilder( addReferenceState(resolvedStateAndRef.referenced()) } } else { - log.warn("WARNING: You must pass in a ServiceHub reference to TransactionBuilder to resolve " + - "state pointers outside of flows. If you are writing a unit test then pass in a " + - "MockServices instance.") + if (nextStatePointer.isResolved) { + log.warn("WARNING: You must pass in a ServiceHub reference to TransactionBuilder to resolve " + + "state pointers outside of flows. If you are writing a unit test then pass in a " + + "MockServices instance.") + } return } }