Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Added test to justify the change
Browse files Browse the repository at this point in the history
  • Loading branch information
tmohay committed Dec 4, 2018
1 parent 679e20e commit f8673aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,6 @@ private VoteTally constructMissingCacheEntries(
voteTallyUpdater.updateForBlock(h, mutableVoteTally);
voteTallyCache.put(h.getHash(), mutableVoteTally.copy());
}
return tally;
return mutableVoteTally;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public void constructThreeBlockChain() {
}
headerBuilder.extraData(
new CliqueExtraData(
BytesValue.wrap(new byte[32]),
Signature.create(BigInteger.TEN, BigInteger.TEN, (byte) 1),
Lists.emptyList())
BytesValue.wrap(new byte[32]),
Signature.create(BigInteger.TEN, BigInteger.TEN, (byte) 1),
validators)
.encode());

genesisBlock = createEmptyBlock(0, Hash.ZERO);
Expand Down Expand Up @@ -167,12 +167,15 @@ public void integrationTestingVotesBeingApplied() {

final VoteTallyCache cache = new VoteTallyCache(blockChain, tallyUpdater, epochManager);

final VoteTally initialVoteTally = cache.getVoteTallyAfterBlock(block_1.getHeader());
assertThat(initialVoteTally.getValidators()).containsAll(validators);
VoteTally voteTally = cache.getVoteTallyAfterBlock(block_1.getHeader());
assertThat(voteTally.getValidators()).containsAll(validators);

final VoteTally finalVoteTally = cache.getVoteTallyAfterBlock(block_2.getHeader());
voteTally = cache.getVoteTallyAfterBlock(block_2.getHeader());

assertThat(initialVoteTally.getValidators())
assertThat(voteTally.getValidators())
.containsExactly(validators.get(0), validators.get(1));

voteTally = cache.getVoteTallyAfterBlock(block_1.getHeader());
assertThat(voteTally.getValidators()).containsAll(validators);
}
}

0 comments on commit f8673aa

Please sign in to comment.