From cbf89ba98b7e59448c8200d3dc3782f3761f3071 Mon Sep 17 00:00:00 2001
From: mkit <michal.kit@evrythng.com>
Date: Tue, 5 Sep 2017 10:07:55 +0100
Subject: [PATCH] Deprecating verifiedTransactions from the public API (#1418)

---
 .../net/corda/client/jfx/model/NodeMonitorModel.kt |  2 +-
 .../kotlin/net/corda/core/messaging/CordaRPCOps.kt | 14 ++++++++++----
 .../kotlin/net/corda/docs/ClientRpcTutorial.kt     |  2 +-
 .../net/corda/node/internal/CordaRPCOpsImpl.kt     |  6 +++---
 .../kotlin/net/corda/node/CordaRPCOpsImplTest.kt   |  2 +-
 .../net/corda/attachmentdemo/AttachmentDemo.kt     |  2 +-
 .../net/corda/demobench/views/NodeTerminalView.kt  |  2 +-
 7 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/client/jfx/src/main/kotlin/net/corda/client/jfx/model/NodeMonitorModel.kt b/client/jfx/src/main/kotlin/net/corda/client/jfx/model/NodeMonitorModel.kt
index 33e160c742..7bd9623f52 100644
--- a/client/jfx/src/main/kotlin/net/corda/client/jfx/model/NodeMonitorModel.kt
+++ b/client/jfx/src/main/kotlin/net/corda/client/jfx/model/NodeMonitorModel.kt
@@ -89,7 +89,7 @@ class NodeMonitorModel {
         vaultUpdates.startWith(initialVaultUpdate).subscribe(vaultUpdatesSubject)
 
         // Transactions
-        val (transactions, newTransactions) = proxy.verifiedTransactionsFeed()
+        val (transactions, newTransactions) = proxy.internalVerifiedTransactionsFeed()
         newTransactions.startWith(transactions).subscribe(transactionsSubject)
 
         // SM -> TX mapping
diff --git a/core/src/main/kotlin/net/corda/core/messaging/CordaRPCOps.kt b/core/src/main/kotlin/net/corda/core/messaging/CordaRPCOps.kt
index a0aa250f88..fab679795b 100644
--- a/core/src/main/kotlin/net/corda/core/messaging/CordaRPCOps.kt
+++ b/core/src/main/kotlin/net/corda/core/messaging/CordaRPCOps.kt
@@ -157,15 +157,21 @@ interface CordaRPCOps : RPCOps {
     // DOCEND VaultTrackAPIHelpers
 
     /**
-     * Returns a list of all recorded transactions.
+     * @suppress Returns a list of all recorded transactions.
+     *
+     * TODO This method should be removed once SGX work is finalised and the design of the corresponding API using [FilteredTransaction] can be started
      */
-    fun verifiedTransactionsSnapshot(): List<SignedTransaction>
+    @Deprecated("This method is intended only for internal use and will be removed from the public API soon.")
+    fun internalVerifiedTransactionsSnapshot(): List<SignedTransaction>
 
     /**
-     * Returns a data feed of all recorded transactions and an observable of future recorded ones.
+     * @suppress Returns a data feed of all recorded transactions and an observable of future recorded ones.
+     *
+     * TODO This method should be removed once SGX work is finalised and the design of the corresponding API using [FilteredTransaction] can be started
      */
+    @Deprecated("This method is intended only for internal use and will be removed from the public API soon.")
     @RPCReturnsObservables
-    fun verifiedTransactionsFeed(): DataFeed<List<SignedTransaction>, SignedTransaction>
+    fun internalVerifiedTransactionsFeed(): DataFeed<List<SignedTransaction>, SignedTransaction>
 
     /**
      * Returns a snapshot list of existing state machine id - recorded transaction hash mappings.
diff --git a/docs/source/example-code/src/main/kotlin/net/corda/docs/ClientRpcTutorial.kt b/docs/source/example-code/src/main/kotlin/net/corda/docs/ClientRpcTutorial.kt
index 64992a788f..f64503f2c0 100644
--- a/docs/source/example-code/src/main/kotlin/net/corda/docs/ClientRpcTutorial.kt
+++ b/docs/source/example-code/src/main/kotlin/net/corda/docs/ClientRpcTutorial.kt
@@ -63,7 +63,7 @@ fun main(args: Array<String>) {
         // END 2
 
         // START 3
-        val (transactions: List<SignedTransaction>, futureTransactions: Observable<SignedTransaction>) = proxy.verifiedTransactionsFeed()
+        val (transactions: List<SignedTransaction>, futureTransactions: Observable<SignedTransaction>) = proxy.internalVerifiedTransactionsFeed()
         // END 3
 
         // START 4
diff --git a/node/src/main/kotlin/net/corda/node/internal/CordaRPCOpsImpl.kt b/node/src/main/kotlin/net/corda/node/internal/CordaRPCOpsImpl.kt
index 0e76592081..64f26c7c51 100644
--- a/node/src/main/kotlin/net/corda/node/internal/CordaRPCOpsImpl.kt
+++ b/node/src/main/kotlin/net/corda/node/internal/CordaRPCOpsImpl.kt
@@ -71,13 +71,13 @@ class CordaRPCOpsImpl(
         }
     }
 
-    override fun verifiedTransactionsSnapshot(): List<SignedTransaction> {
-        val (snapshot, updates) = verifiedTransactionsFeed()
+    override fun internalVerifiedTransactionsSnapshot(): List<SignedTransaction> {
+        val (snapshot, updates) = internalVerifiedTransactionsFeed()
         updates.notUsed()
         return snapshot
     }
 
-    override fun verifiedTransactionsFeed(): DataFeed<List<SignedTransaction>, SignedTransaction> {
+    override fun internalVerifiedTransactionsFeed(): DataFeed<List<SignedTransaction>, SignedTransaction> {
         return database.transaction {
             services.validatedTransactions.track()
         }
diff --git a/node/src/test/kotlin/net/corda/node/CordaRPCOpsImplTest.kt b/node/src/test/kotlin/net/corda/node/CordaRPCOpsImplTest.kt
index bf7e9a375d..ebfd43b407 100644
--- a/node/src/test/kotlin/net/corda/node/CordaRPCOpsImplTest.kt
+++ b/node/src/test/kotlin/net/corda/node/CordaRPCOpsImplTest.kt
@@ -137,7 +137,7 @@ class CordaRPCOpsImplTest {
     fun `issue and move`() {
         aliceNode.database.transaction {
             stateMachineUpdates = rpc.stateMachinesFeed().updates
-            transactions = rpc.verifiedTransactionsFeed().updates
+            transactions = rpc.internalVerifiedTransactionsFeed().updates
             vaultTrackCash = rpc.vaultTrackBy<Cash.State>().updates
         }
 
diff --git a/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt b/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt
index c883411e67..1b24d48640 100644
--- a/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt
+++ b/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt
@@ -131,7 +131,7 @@ class AttachmentDemoFlow(val otherSide: Party, val notary: Party, val hash: Secu
 
 fun recipient(rpc: CordaRPCOps) {
     println("Waiting to receive transaction ...")
-    val stx = rpc.verifiedTransactionsFeed().updates.toBlocking().first()
+    val stx = rpc.internalVerifiedTransactionsFeed().updates.toBlocking().first()
     val wtx = stx.tx
     if (wtx.attachments.isNotEmpty()) {
         if (wtx.outputs.isNotEmpty()) {
diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt
index 51905c0b6f..b67b4b55d0 100644
--- a/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt
+++ b/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt
@@ -187,7 +187,7 @@ class NodeTerminalView : Fragment() {
 
     private fun initialise(config: NodeConfig, ops: CordaRPCOps) {
         try {
-            val (txInit, txNext) = ops.verifiedTransactionsFeed()
+            val (txInit, txNext) = ops.internalVerifiedTransactionsFeed()
             val (stateInit, stateNext) = ops.vaultTrackBy<ContractState>(paging = pageSpecification)
 
             txCount = txInit.size