Commit 9393fc75 authored by Andreas Bigger's avatar Andreas Bigger

Small fixes

parent 4461b963
......@@ -108,10 +108,9 @@ func (s *claimSolver) AttemptStep(ctx context.Context, game types.Game, claim ty
return StepData{}, err
}
} else {
// We agree with the claim so Defend and use this claim as the starting point to execute the step after
// Thus we need the pre-state of the next step
defendingPosition := types.NewPosition(s.gameDepth, int(claim.TraceIndex(s.gameDepth))+1)
preState, proofData, oracleData, err = s.trace.GetStepData(ctx, defendingPosition)
// We agree with the claim so Defend and use this claim as the starting point to
// execute the step after. Thus we need the pre-state of the next step.
preState, proofData, oracleData, err = s.trace.GetStepData(ctx, claim.NextStepPosition(s.gameDepth))
if err != nil {
return StepData{}, err
}
......
......@@ -18,6 +18,13 @@ func NewPositionFromGIndex(x uint64) Position {
return NewPosition(depth, int(indexAtDepth))
}
func (p Position) NextStepPosition(gameDepth int) Position {
return Position{
depth: gameDepth,
indexAtDepth: int(p.TraceIndex(gameDepth) + 1),
}
}
func (p Position) Depth() int {
return p.depth
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment