-
Notifications
You must be signed in to change notification settings - Fork 370
Conversation
a2fe772
to
f054f90
Compare
f054f90
to
19a2465
Compare
double getpSendMilestone(); | ||
|
||
/** | ||
* @return Descriptions#P_PROPAGATE_REQUEST | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is missing @value
annotation.
You made this mistake because you copy pasted code that was never reviewed (I guess this is why reviews are important).
Anyhows #1159 should fix this so you can simply discard the changes to this file
@@ -128,7 +129,8 @@ public void shutdown() { | |||
* | |||
* @param latestMilestoneTracker tracker for the milestones to determine when a new local snapshot is due | |||
*/ | |||
private void monitorThread(LatestMilestoneTracker latestMilestoneTracker) { | |||
//Package Private For Testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the @VisibleForTesting
no?
@@ -154,38 +156,42 @@ private void monitorThread(LatestMilestoneTracker latestMilestoneTracker) { | |||
* @param inSync if this node is in sync | |||
* @return the current interval in which we take local snapshots | |||
*/ | |||
private int getSnapshotInterval(boolean inSync) { | |||
//Package Private For Testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
* | ||
* @param latestMilestoneTracker tracker we use to determine milestones | ||
* @return <code>true</code> if we are in sync, otherwise <code>false</code> | ||
*/ | ||
private boolean isInSync(LatestMilestoneTracker latestMilestoneTracker) { | ||
// Package Private For Testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
lsManager.monitorThread(milestoneTracker); | ||
|
||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use lambda?
new Thread( () -> lsManager.monitorThread(milestoneTracker))
} | ||
|
||
@After | ||
public void tearDown() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throws Exception
should be deleted...
Doesn't your IDE tell you this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It did not! :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So why didn't you delete?
@Test | ||
public void testGetBalances() { | ||
assertEquals("State should not have balances", new HashMap<>(), state.getBalances()); | ||
assertEquals("State should have the ballances it was created with", map, balanceState.getBalances()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo "ballances"
state.applyStateDiff(diff); | ||
|
||
long balance = state.getBalance(Hash.NULL_HASH); | ||
assertEquals("Applying state to an empty state should have 5 for genisis", 5l, balance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"genesis"
patchedState = balanceState.patchedState(diff); | ||
|
||
long balance = patchedState.getBalance(Hash.NULL_HASH); | ||
assertEquals("5 should have been added to genisis", TransactionViewModel.SUPPLY - 5l, balance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"genesis"
@@ -62,7 +62,8 @@ | |||
* snapshot multiple times while creating their own version of the LocalSnapshotManager, we cache the instance | |||
* here so they don't have to rebuild it from the scratch every time (massively speeds up the unit tests). | |||
*/ | |||
private static SnapshotImpl builtinSnapshot = null; | |||
// Package private For Testing | |||
static SnapshotImpl builtinSnapshot = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to have @VisibleForTesting
method that nullfies the bulitinSnapshot
Let's not expose more than we need to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know something. This shouldn't be a static field. Can you open an issue for that please?
…out testnet config test
19a2465
to
203dd16
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good.
Just delete the throws
, add a comment, and open an issue and I shall approve
} | ||
|
||
@After | ||
public void tearDown() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So why didn't you delete?
this.lsManager = new LocalSnapshotManagerImpl(); | ||
|
||
lsManager.init(snapshotProvider, snapshotService, transactionPruner, config); | ||
when(snapshotProvider.getLatestSnapshot().getIndex()).thenReturn(-5, -1, 10, 998, 999, 1999, 2000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I don't know....
I would add a comment in the test code that we don't really support negative indexes
@@ -62,7 +62,8 @@ | |||
* snapshot multiple times while creating their own version of the LocalSnapshotManager, we cache the instance | |||
* here so they don't have to rebuild it from the scratch every time (massively speeds up the unit tests). | |||
*/ | |||
private static SnapshotImpl builtinSnapshot = null; | |||
// Package private For Testing | |||
static SnapshotImpl builtinSnapshot = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know something. This shouldn't be a static field. Can you open an issue for that please?
Description
Added unit tests to all other local snapshot files
Added javadoc to LS related config
Fixes #1091
Cannot be merged before merging of #1363
Type of change
Checklist: