Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue in payload disposing and add unit test for asking multiple times by the same payloadId #4262

Merged
merged 4 commits into from
Jul 9, 2022

Conversation

jmederosalvarado
Copy link
Member

Changes:

  • Fix an issue that caused the BlockImprovementContext.CancellationTokenSource to be disposed multiple times
  • Add unit test to verify we can ask multiple times using the same payloadId without errors

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Other (please describe):

Testing

Requires testing

  • Yes
  • No

In case you checked yes, did you write tests??

  • Yes
  • No

{
return blockContext.CurrentBestBlock;
}
return blockContext.CurrentBestBlock;
Copy link
Member

Choose a reason for hiding this comment

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

This is actually a downgrade. I think we want to stop improvements on first get.

Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

Pushed fixes, we still want to stop improving block after first get, but Dispose should be implemented in a way that allows multiple calls. This is .Net requirement, from docs:

If an object's Dispose method is called more than once, the object must ignore all calls after the first one. The object must not throw an exception if its Dispose method is called multiple times.

@LukaszRozmej LukaszRozmej merged commit b617fa0 into master Jul 9, 2022
@LukaszRozmej LukaszRozmej deleted the fix/multiple_payload_dispose branch July 9, 2022 21:53
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.

None yet

2 participants