Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Conversation

@quantumagi
Copy link
Contributor

for (int i = 0; i < addChangesTimes; i++)
var random = new Random();

while (currentHeight > 1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this going to loop until random returns a 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we keep rewinding between >0% and 100% of the remaining blocks until there is nothing left to rewind.

currentHeight = random.Next(currentHeight - 1) + 1; will always reduce currentHeight.

{
this.hash = this.coinView.Rewind();
this.blockHeight--;
this.hash = this.coinView.Rewind(--this.blockHeight);
Copy link
Collaborator

@codingupastorm codingupastorm Nov 20, 2019

Choose a reason for hiding this comment

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

Is this correct? This is different functionality to previously. This will pass blockHeight-1 to Rewind.

Copy link
Contributor Author

@quantumagi quantumagi Nov 20, 2019

Choose a reason for hiding this comment

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

Yes. It's the target height. Previously we implicitly passed blockHeight-1 to Rewind. Now its explicit.

@quantumagi quantumagi requested a review from fassadlr November 20, 2019 08:39
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.

2 participants