-
Notifications
You must be signed in to change notification settings - Fork 312
[3.0.8.0] Fast Rewind #4082
base: release/3.0.8.0
Are you sure you want to change the base?
[3.0.8.0] Fast Rewind #4082
Conversation
for (int i = 0; i < addChangesTimes; i++) | ||
var random = new Random(); | ||
|
||
while (currentHeight > 1) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
.
@@ -75,8 +75,7 @@ public uint256 NewBlock() | |||
|
|||
public uint256 Rewind() | |||
{ | |||
this.hash = this.coinView.Rewind(); | |||
this.blockHeight--; | |||
this.hash = this.coinView.Rewind(--this.blockHeight); |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
https://stratisplatformuk.visualstudio.com/StratisBitcoinFullNode/_workitems/edit/3338/