Skip to content

Commit 4978462

Browse files
author
abstrct
committed
Fixed 0 block hashing results for mining and refinement
1 parent 2acf355 commit 4978462

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

x/structs/keeper/msg_server_struct_build_complete.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func (k msgServer) StructBuildComplete(goCtx context.Context, msg *types.MsgStru
3535
}
3636

3737
if structure.IsBuilt() {
38-
structure.GetOwner().Discharge()
39-
structure.GetOwner().Commit()
38+
//structure.GetOwner().Discharge()
39+
//structure.GetOwner().Commit()
4040
return &types.MsgStructStatusResponse{}, types.NewStructStateError(msg.StructId, "built", "building", "build_complete")
4141
}
4242

@@ -58,9 +58,9 @@ func (k msgServer) StructBuildComplete(goCtx context.Context, msg *types.MsgStru
5858
structure.GetOwner().StructsLoadDecrement(structure.GetStructType().BuildDraw)
5959

6060
if !structure.GetOwner().CanSupportLoadAddition(structure.GetStructType().PassiveDraw) {
61-
structure.GetOwner().StructsLoadIncrement(structure.GetStructType().BuildDraw)
61+
//structure.GetOwner().StructsLoadIncrement(structure.GetStructType().BuildDraw)
6262
//structure.GetOwner().Discharge()
63-
structure.GetOwner().Commit()
63+
//structure.GetOwner().Commit()
6464
return &types.MsgStructStatusResponse{}, types.NewPlayerPowerError(structure.GetOwnerId(), "capacity_exceeded").WithCapacity(structure.GetStructType().PassiveDraw, structure.GetOwner().GetAvailableCapacity())
6565
}
6666

@@ -72,10 +72,10 @@ func (k msgServer) StructBuildComplete(goCtx context.Context, msg *types.MsgStru
7272

7373
valid, achievedDifficulty := types.HashBuildAndCheckDifficulty(hashInput, msg.Proof, currentAge, structure.GetStructType().BuildDifficulty)
7474
if !valid {
75-
structure.GetOwner().StructsLoadIncrement(structure.GetStructType().BuildDraw)
75+
//structure.GetOwner().StructsLoadIncrement(structure.GetStructType().BuildDraw)
7676
//structure.GetOwner().Discharge()
7777
//structure.GetOwner().Halt()
78-
structure.GetOwner().Commit()
78+
//structure.GetOwner().Commit()
7979
return &types.MsgStructStatusResponse{}, types.NewWorkFailureError("build", structure.GetStructId(), hashInput)
8080
}
8181

x/structs/keeper/struct_cache.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,9 +902,11 @@ func (cache *StructCache) CanOreMinePlanet() error {
902902
return types.NewStructCapabilityError(cache.StructId, "mining")
903903
}
904904

905+
/*
905906
if cache.GetBlockStartOreMine() == 0 {
906907
return types.NewStructStateError(cache.StructId, "not_mining", "mining", "ore_mine")
907908
}
909+
*/
908910

909911
if cache.GetPlanet().IsComplete() {
910912
return types.NewPlanetStateError(cache.GetPlanet().GetPlanetId(), "complete", "mine")
@@ -931,9 +933,11 @@ func (cache *StructCache) CanOreRefine() error {
931933
return types.NewStructCapabilityError(cache.StructId, "refining")
932934
}
933935

936+
/*
934937
if cache.GetBlockStartOreRefine() == 0 {
935938
return types.NewStructStateError(cache.StructId, "not_refining", "refining", "ore_refine")
936939
}
940+
*/
937941

938942
if !cache.GetOwner().HasStoredOre() {
939943
return types.NewPlayerAffordabilityError(cache.GetOwner().PlayerId, "refine", "ore")

x/structs/module/genesis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
9696
for _, elem := range genState.StructAttributeList {
9797
value := elem.Value
9898
if isStructBlockHeightAttribute(elem.AttributeId) {
99-
value = 1
99+
value = 0
100100
}
101101
k.SetStructAttribute(ctx, elem.AttributeId, value)
102102
}

0 commit comments

Comments
 (0)