diff --git a/core/src/main/kotlin/net/corda/core/internal/notary/AsyncCFTNotaryService.kt b/core/src/main/kotlin/net/corda/core/internal/notary/AsyncCFTNotaryService.kt index 27ce1be073..3dfa3347c4 100644 --- a/core/src/main/kotlin/net/corda/core/internal/notary/AsyncCFTNotaryService.kt +++ b/core/src/main/kotlin/net/corda/core/internal/notary/AsyncCFTNotaryService.kt @@ -37,9 +37,10 @@ abstract class AsyncCFTNotaryService : TrustedAuthorityNotaryService() { txId: SecureHash, callerIdentity: Party, requestSignature: NotarisationRequestSignature, - timeWindow: TimeWindow? + timeWindow: TimeWindow?, + references: List ): CordaFuture { - return asyncUniquenessProvider.commitAsync(states, txId, callerIdentity, requestSignature, timeWindow) + return asyncUniquenessProvider.commitAsync(states, txId, callerIdentity, requestSignature, timeWindow, references) } /** @@ -53,9 +54,11 @@ abstract class AsyncCFTNotaryService : TrustedAuthorityNotaryService() { val txId: SecureHash, val caller: Party, val requestSignature: NotarisationRequestSignature, - val timeWindow: TimeWindow?) : FlowAsyncOperation { + val timeWindow: TimeWindow?, + val references: List + ): FlowAsyncOperation { override fun execute(): CordaFuture { - return service.commitAsync(inputs, txId, caller, requestSignature, timeWindow) + return service.commitAsync(inputs, txId, caller, requestSignature, timeWindow, references) } } } diff --git a/core/src/main/kotlin/net/corda/core/internal/notary/AsyncUniquenessProvider.kt b/core/src/main/kotlin/net/corda/core/internal/notary/AsyncUniquenessProvider.kt index b611f6fdbc..f999fe6147 100644 --- a/core/src/main/kotlin/net/corda/core/internal/notary/AsyncUniquenessProvider.kt +++ b/core/src/main/kotlin/net/corda/core/internal/notary/AsyncUniquenessProvider.kt @@ -24,11 +24,11 @@ import net.corda.core.identity.Party */ interface AsyncUniquenessProvider : UniquenessProvider { /** Commits all input states of the given transaction. */ - fun commitAsync(states: List, txId: SecureHash, callerIdentity: Party, requestSignature: NotarisationRequestSignature, timeWindow: TimeWindow?): CordaFuture + fun commitAsync(states: List, txId: SecureHash, callerIdentity: Party, requestSignature: NotarisationRequestSignature, timeWindow: TimeWindow?, references: List): CordaFuture /** Commits all input states of the given transaction synchronously. Use [commitAsync] for better performance. */ - override fun commit(states: List, txId: SecureHash, callerIdentity: Party, requestSignature: NotarisationRequestSignature, timeWindow: TimeWindow?) { - val result = commitAsync(states, txId, callerIdentity, requestSignature, timeWindow).get() + override fun commit(states: List, txId: SecureHash, callerIdentity: Party, requestSignature: NotarisationRequestSignature, timeWindow: TimeWindow?, references: List) { + val result = commitAsync(states, txId, callerIdentity, requestSignature, timeWindow,references).get() if (result is Result.Failure) { throw NotaryInternalException(result.error) } diff --git a/node/src/integration-test/kotlin/net/corda/node/services/MySQLNotaryServiceTests.kt b/node/src/integration-test/kotlin/net/corda/node/services/MySQLNotaryServiceTests.kt index 74d6cd2261..9725b364dc 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/MySQLNotaryServiceTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/MySQLNotaryServiceTests.kt @@ -240,7 +240,8 @@ class MySQLNotaryServiceTests : IntegrationTest() { txId, callerParty, requestSignature, - null).execute() + null, + emptyList()).execute() } return futures.transpose().get() } diff --git a/node/src/main/kotlin/net/corda/node/services/transactions/MySQLUniquenessProvider.kt b/node/src/main/kotlin/net/corda/node/services/transactions/MySQLUniquenessProvider.kt index f91b0fe201..57137eef84 100644 --- a/node/src/main/kotlin/net/corda/node/services/transactions/MySQLUniquenessProvider.kt +++ b/node/src/main/kotlin/net/corda/node/services/transactions/MySQLUniquenessProvider.kt @@ -98,6 +98,7 @@ class MySQLUniquenessProvider( val callerIdentity: Party, val requestSignature: NotarisationRequestSignature, val timeWindow: TimeWindow?, + val references: List, val id: UUID = UUID.randomUUID()) private val metricPrefix = MySQLUniquenessProvider::class.simpleName @@ -176,11 +177,12 @@ class MySQLUniquenessProvider( txId: SecureHash, callerIdentity: Party, requestSignature: NotarisationRequestSignature, - timeWindow: TimeWindow? + timeWindow: TimeWindow?, + references: List ): CordaFuture { inputStateCount.update(states.size) val timer = Stopwatch.createStarted() - val request = CommitRequest(states, txId, callerIdentity, requestSignature, timeWindow) + val request = CommitRequest(states, txId, callerIdentity, requestSignature, timeWindow, references) val future = openFuture() requestFutures[request.id] = future future.then { diff --git a/node/src/main/kotlin/net/corda/node/services/vault/NodeVaultService.kt b/node/src/main/kotlin/net/corda/node/services/vault/NodeVaultService.kt index 20fcea0e1a..65d2995b05 100644 --- a/node/src/main/kotlin/net/corda/node/services/vault/NodeVaultService.kt +++ b/node/src/main/kotlin/net/corda/node/services/vault/NodeVaultService.kt @@ -498,17 +498,14 @@ class NodeVaultService( Vault.Page(states = statesAndRefs, statesMetadata = statesMeta, stateTypes = criteriaParser.stateTypes, totalStatesAvailable = totalStates, otherResults = otherResults) } } - @Throws(VaultQueryException::class) override fun _trackBy(criteria: QueryCriteria, paging: PageSpecification, sorting: Sort, contractStateType: Class): DataFeed, Vault.Update> { - return mutex.locked { - concurrentBox.exclusive { - val snapshotResults = _queryBy(criteria, paging, sorting, contractStateType) - val updates: Observable> = uncheckedCast(_updatesPublisher.bufferUntilSubscribed() - .filter { it.containsType(contractStateType, snapshotResults.stateTypes) } - .map { filterContractStates(it, contractStateType) }) - DataFeed(snapshotResults, updates) - } + return concurrentBox.exclusive { + val snapshotResults = _queryBy(criteria, paging, sorting, contractStateType) + val updates: Observable> = uncheckedCast(_updatesPublisher.bufferUntilSubscribed() + .filter { it.containsType(contractStateType, snapshotResults.stateTypes) } + .map { filterContractStates(it, contractStateType) }) + DataFeed(snapshotResults, updates) } } diff --git a/tools/notarytest/src/main/kotlin/net/corda/notarytest/flows/AsyncLoadTestFlow.kt b/tools/notarytest/src/main/kotlin/net/corda/notarytest/flows/AsyncLoadTestFlow.kt index 69de8d9e8c..02170f8e0a 100644 --- a/tools/notarytest/src/main/kotlin/net/corda/notarytest/flows/AsyncLoadTestFlow.kt +++ b/tools/notarytest/src/main/kotlin/net/corda/notarytest/flows/AsyncLoadTestFlow.kt @@ -82,7 +82,8 @@ open class AsyncLoadTestFlow( val inputs = inputGenerator.generateOrFail(random) val requestSignature = NotarisationRequest(inputs, txId).generateSignature(serviceHub) - futures += AsyncCFTNotaryService.CommitOperation(service, inputs, txId, callerParty, requestSignature, null).execute() + futures += AsyncCFTNotaryService.CommitOperation(service, inputs, txId, callerParty, requestSignature, + null, emptyList()).execute() } futures.transpose().get()