diff --git a/src/main/java/com/iota/iri/Milestone.java b/src/main/java/com/iota/iri/Milestone.java index 7bec19f472..bf8ecd0d71 100644 --- a/src/main/java/com/iota/iri/Milestone.java +++ b/src/main/java/com/iota/iri/Milestone.java @@ -108,6 +108,7 @@ public void init(final SpongeFactory.Mode mode, final LedgerValidator ledgerVali final Validity valid = validateMilestone(mode, t, getIndex(t)); switch (valid) { case VALID: + t.setIsSnapshot(tangle, true); MilestoneViewModel milestoneViewModel = MilestoneViewModel.latest(tangle); if (milestoneViewModel != null && milestoneViewModel.index() > latestMilestoneIndex) { latestMilestone = milestoneViewModel.getHash(); diff --git a/src/main/java/com/iota/iri/controllers/TransactionViewModel.java b/src/main/java/com/iota/iri/controllers/TransactionViewModel.java index 8b20a5aaae..864469faa1 100644 --- a/src/main/java/com/iota/iri/controllers/TransactionViewModel.java +++ b/src/main/java/com/iota/iri/controllers/TransactionViewModel.java @@ -409,6 +409,17 @@ public void setSnapshot(Tangle tangle, final int index) throws Exception { } } + public void setIsSnapshot(Tangle tangle, final boolean isSnapshot) throws Exception { + if ( isSnapshot != transaction.isSnapshot ) { + transaction.isSnapshot = isSnapshot; + update(tangle, "isSnapshot"); + } + } + + public boolean getIsSnapshot() { + return transaction.isSnapshot; + } + public long getHeight() { return transaction.height; }