-
Notifications
You must be signed in to change notification settings - Fork 130
Unit tests of BlockBroadcaster #887
Unit tests of BlockBroadcaster #887
Conversation
@@ -561,4 +566,25 @@ public void shouldNotImportBlocksThatAreAlreadyBeingImported() { | |||
|
|||
verify(ethScheduler, times(1)).scheduleSyncWorkerTask(any(Supplier.class)); | |||
} | |||
|
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.
Idea: Would it test any addition workflow (I'm not sure offhand) if you added a third node? ie, create the block on first node like currently. have node 2 process everything with native (non-test code), and wait for the message to arrive or process on 3rd node?
.mixHash(Hash.ZERO) | ||
.nonce(0L) | ||
.blockHashFunction(MainnetBlockHashFunction::createHash) | ||
.buildBlockHeader(); |
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 just use BlockHeaderTestFixure
to create a simple test block.
65e6eb3
to
9215bb6
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.
LGTM.
} | ||
|
||
@Test | ||
public void blockPropagationRejectOnHasSeenBlock() { |
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.
We probably don't need this one given we have the test above to check we send only to peers that haven't seen the block.
PR description
includes two unit tests:
--> one the confirms the
propagateBlock
method onEthPeer
is invoked when all criteria are satisfied.--> one that confirms the
propagateBlock
method onEthPeer
is not invoked when all criteria are not satisfied.NOTE
when 808 lands the change set of this code will be reduced to only the file
BlockBroadcasterTest.java
Fixed Issue(s)