-
Notifications
You must be signed in to change notification settings - Fork 370
send heartbeat pulses and request tx using heartbeat #1830
base: dev
Are you sure you want to change the base?
send heartbeat pulses and request tx using heartbeat #1830
Conversation
@@ -22,6 +22,8 @@ | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
|
|||
import java.util.List; |
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.
Issue found: Avoid unused imports such as 'java.util.List'
import com.iota.iri.network.NeighborRouter; | ||
import com.iota.iri.network.TipsRequester; | ||
import com.iota.iri.network.TransactionRequester; | ||
import com.iota.iri.network.*; |
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.
Issue found: Avoid unused imports such as 'com.iota.iri.network'
private final SilentScheduledExecutorService executorService = new DedicatedScheduledExecutorService( | ||
"Heartbeat Pulse"); | ||
|
||
public HeartbeatPulseImpl(NeighborRouter neighborRouter, SnapshotProvider snapshotProvider) { |
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.
Issue found: Public method and constructor comments are required
int max = 0; | ||
for (PruningCondition condition: pruningConditions) { | ||
if(condition.getSnapshotPruningMilestone() > max){ | ||
max = condition.getSnapshotPruningMilestone(); |
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.
This should be the smallest milestone no? As we only prune the one that is lowest possible (to prevent pruning too much)
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.
Ah. Yes
Description
Adds a new thread that sends
heartbeat
messages to neighbours every minute.Then it requests txs only from neighbours who have the tx by checking their first and last solid milestone index from the heartbeat.
If the neighbour does not support protocol v2 yet, we request from it anyways.
Fixes #1798
Type of change
How Has This Been Tested?
Add unit tests that check that txs are broadcasted only from neighbors according to their heartbeat.
Checklist: