Open
Conversation
# Conflicts: # src/blockchain/Block.java # src/blockchain/Blockchain.java # src/blockchain/Main.java # src/blockchain/miners/Miner.java
swsms
reviewed
Jan 17, 2019
swsms
left a comment
There was a problem hiding this comment.
Great blockchain implementation. A little more, and you can open your own crypto platform. Just implement distributed version of this application :)
| private final String hash; | ||
| private final Long timestamp; | ||
| private final Integer magicNumber; | ||
| private List<T> data = List.of(); |
src/blockchain/Blockchain.java
Outdated
| private BiFunction<Integer, String, Optional<T>> systemFeedback; | ||
|
|
||
| public Blockchain(Persister<T> persister, DataFormatter<T> dataFormatter, | ||
| BiFunction<Integer, String, Optional<T>> systemFeedback) { |
There was a problem hiding this comment.
The system feedback function is quite large in the definition. Maybe it is better to represent it as your own interface, like:
interface SystemFeedback extends BiFunction<Integer, String, Optional<T>> { ... }
src/blockchain/Blockchain.java
Outdated
|
|
||
| public Stream<T> data() { | ||
| ReadLock readLock = readWritelock.readLock(); | ||
| try { |
There was a problem hiding this comment.
It seems that the lock is superfluous here. Since streams are lazy, data from the source will be obtained in a completely different place. Actually, you do not perform the read operation here, just configure your stream to perform this operation somewhere else.
| import java.util.List; | ||
|
|
||
| public class FilePersister<T extends SignedData & Serializable> implements Persister<T> { | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.