From 0dcd59c512b80da55e19e65c5dd4c986cce855ed Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Thu, 25 Apr 2019 17:09:02 +0200 Subject: [PATCH] Remvoed imports, added assert messages --- src/main/java/com/iota/iri/Iota.java | 1 - .../transactionpruning/PrunedTransactionVerifier.java | 3 +++ .../PrunedTransactionVerifierImplTest.java | 11 +++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/iota/iri/Iota.java b/src/main/java/com/iota/iri/Iota.java index 23779fe59f..480df9d5da 100644 --- a/src/main/java/com/iota/iri/Iota.java +++ b/src/main/java/com/iota/iri/Iota.java @@ -22,7 +22,6 @@ import com.iota.iri.service.tipselection.*; import com.iota.iri.service.tipselection.impl.*; import com.iota.iri.service.transactionpruning.PrunedTransactionException; -import com.iota.iri.service.transactionpruning.PrunedTransactionProvider; import com.iota.iri.service.transactionpruning.PrunedTransactionVerifier; import com.iota.iri.service.transactionpruning.TransactionPruningException; import com.iota.iri.service.transactionpruning.async.AsyncTransactionPruner; diff --git a/src/main/java/com/iota/iri/service/transactionpruning/PrunedTransactionVerifier.java b/src/main/java/com/iota/iri/service/transactionpruning/PrunedTransactionVerifier.java index 11c867358c..4cef983a2a 100644 --- a/src/main/java/com/iota/iri/service/transactionpruning/PrunedTransactionVerifier.java +++ b/src/main/java/com/iota/iri/service/transactionpruning/PrunedTransactionVerifier.java @@ -3,6 +3,9 @@ import com.iota.iri.controllers.TransactionViewModel; import com.iota.iri.model.Hash; +/** + * Verifies the integrity of a chain of pruned transactions by checking each trunk/branch. + */ public interface PrunedTransactionVerifier { /** diff --git a/src/test/java/com/iota/iri/service/transactionpruning/PrunedTransactionVerifierImplTest.java b/src/test/java/com/iota/iri/service/transactionpruning/PrunedTransactionVerifierImplTest.java index e15e1c7379..6add733f76 100644 --- a/src/test/java/com/iota/iri/service/transactionpruning/PrunedTransactionVerifierImplTest.java +++ b/src/test/java/com/iota/iri/service/transactionpruning/PrunedTransactionVerifierImplTest.java @@ -15,7 +15,6 @@ import com.iota.iri.TransactionTestUtils; import com.iota.iri.conf.SnapshotConfig; -import com.iota.iri.controllers.TransactionViewModel; import com.iota.iri.model.Hash; import com.iota.iri.network.TransactionRequester; import com.iota.iri.service.transactionpruning.impl.PrunedTransactionProviderImpl; @@ -63,16 +62,16 @@ public void tearDown() { public void isPossiblyPrunedTest() throws PrunedTransactionException { Mockito.when(provider.containsTransaction(A)).thenReturn(true); - assertTrue(verifier.isPossiblyPruned(A)); - assertFalse(verifier.isPossiblyPruned(B)); + assertTrue("A should be seen as pruned", verifier.isPossiblyPruned(A)); + assertFalse("B should not be seen as pruned", verifier.isPossiblyPruned(B)); } @Test public void waitingForHashTest() throws PrunedTransactionException { - assertFalse(verifier.isPruned(A)); - assertTrue(verifier.waitingForHash(A)); + assertFalse("A should not be seen as definitely pruned", verifier.isPruned(A)); + assertTrue("Verifier should be waiting for TVM for A", verifier.waitingForHash(A)); - assertFalse(verifier.waitingForHash(B)); + assertFalse("Verifier should not be waitingfor TVM for B", verifier.waitingForHash(B)); } @Test