Skip to content

Commit

Permalink
Feat: added setters and getters + maintain flag for new snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Moog committed Jul 23, 2018
1 parent 405a3dc commit 127ec4a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/iota/iri/Milestone.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/iota/iri/controllers/TransactionViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 127ec4a

Please sign in to comment.