Commit 9267b85f authored by Andreas Bigger's avatar Andreas Bigger

Fix contract indices nit

parent a27f5621
...@@ -51,9 +51,9 @@ type extendedClaim struct { ...@@ -51,9 +51,9 @@ type extendedClaim struct {
type gameState struct { type gameState struct {
agreeWithProposedOutput bool agreeWithProposedOutput bool
root claimEntry root claimEntry
// parents maps a contract index to it's extended claim. // contractIndicies maps a contract index to it's extended claim.
// This is used to perform O(1) parent lookups. // This is used to perform O(1) parent lookups.
parents map[int]*extendedClaim contractIndicies map[int]*extendedClaim
// claims maps a claim entry to it's extended claim. // claims maps a claim entry to it's extended claim.
claims map[claimEntry]*extendedClaim claims map[claimEntry]*extendedClaim
depth uint64 depth uint64
...@@ -74,7 +74,7 @@ func NewGameState(agreeWithProposedOutput bool, root Claim, depth uint64) *gameS ...@@ -74,7 +74,7 @@ func NewGameState(agreeWithProposedOutput bool, root Claim, depth uint64) *gameS
agreeWithProposedOutput: agreeWithProposedOutput, agreeWithProposedOutput: agreeWithProposedOutput,
root: rootClaimEntry, root: rootClaimEntry,
claims: claims, claims: claims,
parents: parents, contractIndicies: parents,
depth: depth, depth: depth,
} }
} }
...@@ -118,7 +118,7 @@ func (g *gameState) Put(claim Claim) error { ...@@ -118,7 +118,7 @@ func (g *gameState) Put(claim Claim) error {
children: make([]claimEntry, 0), children: make([]claimEntry, 0),
} }
g.claims[makeClaimEntry(claim)] = claimWithExtension g.claims[makeClaimEntry(claim)] = claimWithExtension
g.parents[claim.ContractIndex] = claimWithExtension g.contractIndicies[claim.ContractIndex] = claimWithExtension
return nil return nil
} }
...@@ -159,7 +159,7 @@ func (g *gameState) getParent(claim Claim) *extendedClaim { ...@@ -159,7 +159,7 @@ func (g *gameState) getParent(claim Claim) *extendedClaim {
if claim.IsRoot() { if claim.IsRoot() {
return nil return nil
} }
if parent, ok := g.parents[claim.ParentContractIndex]; ok { if parent, ok := g.contractIndicies[claim.ParentContractIndex]; ok {
return parent return parent
} }
return nil return nil
......
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