Skip to content
This repository has been archived by the owner on Aug 23, 2020. It is now read-only.

Fix: Correct walker behaviour for alpha == 0 #1645

Merged
merged 5 commits into from
Dec 3, 2019

Conversation

DyrellC
Copy link
Contributor

@DyrellC DyrellC commented Oct 17, 2019

Description

Currently the walker uses an if(!Collections.EMPTY_MAP.equals(ratings)) check to determine if the alpha value is 0 in the walker. But since the ratings list is is provided by ratingOne this list is not empty. Therefore the node is still performing the walk as though the alpha is not 0. The improved behaviour from not doing the ratings calculation has been the result of the alpha 0 change, but having the walk skip the additional unnecessary calculations on the walk end should show another improvement to response time.

Type of change

  • Bug fix (a non-breaking change which fixes an issue)

How Has This Been Tested?

-Set a break point in the walker to make sure that the walk is registering the correct alpha value and using the correct logic

Checklist:

  • My code follows the style guidelines for this project
  • I have performed a self-review of my own code
  • New and existing unit tests pass locally with my changes

@@ -128,7 +128,7 @@ public Hash walk(Hash entryPoint, Map<Hash, Integer> ratings, WalkValidator walk
int approverIndex;

//Check if ratings map is empty. If so, alpha was set to 0 and a random approver will be selected.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Youre probably going to stab me once or twice, but the comment above it is now wrong :)

@kwek20 kwek20 changed the title Correct walker behaviour for alpha == 0 Fix: Correct walker behaviour for alpha == 0 Oct 30, 2019
@GalRogozinski GalRogozinski merged commit 3ff5ec0 into iotaledger:dev Dec 3, 2019
@GalRogozinski GalRogozinski mentioned this pull request May 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants