Skip to content

Update/2 with new boolean variable peerIsOnlyFailure SnapSyncFeed.cs#2

Merged
ManiBAJPAI22 merged 1 commit into
masterfrom
ManiBAJPAI22-branch-1-1
Jun 12, 2024
Merged

Update/2 with new boolean variable peerIsOnlyFailure SnapSyncFeed.cs#2
ManiBAJPAI22 merged 1 commit into
masterfrom
ManiBAJPAI22-branch-1-1

Conversation

@ManiBAJPAI22

Copy link
Copy Markdown
Owner

The key changes are:

Introduced a new boolean variable peerIsOnlyFailure and initialized it to true. While iterating through _resultLog, if a failure is encountered from a peer other than the current peer, peerIsOnlyFailure is set to false. When checking if peerLastFailures is greater than AllowedInvalidResponses, the code first checks the value of peerIsOnlyFailure.

If peerIsOnlyFailure is true, it means the current peer is solely responsible for all the failures, so it updates the pivot and returns SyncResponseHandlingResult.OK. If peerIsOnlyFailure is false, it means there are failures from other peers as well, so it marks the current peer as SyncResponseHandlingResult.LesserQuality.

Fixes Closes Resolves #

Please choose one of the keywords above to refer to the issue this PR solves followed by the issue number (e.g. Fixes #000). If no issue number, remove the line. Also, remove everything marked optional that is not applicable. Remove this note after reading.

Changes

  • List the changes

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Optional. Remove if not applicable.

Documentation

Requires documentation update

  • Yes
  • No

If yes, link the PR to the docs update or the issue with the details labeled docs. Remove if not applicable.

Requires explanation in Release Notes

  • Yes
  • No

If yes, fill in the details here. Remove if not applicable.

Remarks

Optional. Remove if not applicable.

The key changes are:

Introduced a new boolean variable peerIsOnlyFailure and initialized it to true.
While iterating through _resultLog, if a failure is encountered from a peer other than the current peer, peerIsOnlyFailure is set to false.
When checking if peerLastFailures is greater than AllowedInvalidResponses, the code first checks the value of peerIsOnlyFailure.

If peerIsOnlyFailure is true, it means the current peer is solely responsible for all the failures, so it updates the pivot and returns SyncResponseHandlingResult.OK.
If peerIsOnlyFailure is false, it means there are failures from other peers as well, so it marks the current peer as SyncResponseHandlingResult.LesserQuality.
@ManiBAJPAI22 ManiBAJPAI22 merged commit 737f9ac into master Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant