cliri
cliri copied to clipboard
Connected Components: replace random tip in Entrypoint with random tip from largest component
Currently, Entrypoint is chosen by first uniformly selecting a random tip from all available tips and then walking back until X cumulative weight is reached.
In #86 we explored a few issues with this approach and offered solutions. solution 2.ii. (Connected components) was chosen, as a first step, as a way to differentiate tips.
To enable this feature we tie #88 #89 #90 together: instead of starting with https://github.com/iotaledger/cliri/blob/5640411b17825ad4ebdef7427ec713d6649ca1d6/src/main/java/com/iota/iri/service/tipselection/impl/EntryPointSelectorCumulativeWeightThreshold.java#L43 we uniformly select a random tip from the largest connected component of the recent transactions (the latest X transactions).
pseudo code:
(in EntryPoint)
latestTips = tipsViewModel.getLatestSolidTips(M)
tip = ConnectedComponentsCalculator.randomlySelectTip(latestTips)
func ConnectedComponentsCalculator.randomlySelectTip(tips):
latestTransactions = findNMostRecentTransactions(tips)
connectedComponents = getConnectedComponents(latestTransactions)
return randomlySelectTipFromLargestConnectedComponent(connectedComponents, tips)