diff --git a/node_util/block_hash.go b/node_util/block_hash.go index c4817e7..22dfb1f 100644 --- a/node_util/block_hash.go +++ b/node_util/block_hash.go @@ -64,6 +64,10 @@ func HashBlock(block Block, blockHeight int) [64]byte { if err != nil { panic(err) } + blockCpy.MiningTime = time.Minute + blockCpy.TimeVerifiers = []PublicKey{} + blockCpy.TimeVerifierSignatures = []Signature{} + blockCpy.Timestamp = time.Time{} for i := range block.Transactions { blockCpy.Transactions[i].Timestamp = time.Time{} blockCpy.Transactions[i].Body = []byte{} diff --git a/node_util/create_block.go b/node_util/create_block.go index 8f979d2..92ebf72 100644 --- a/node_util/create_block.go +++ b/node_util/create_block.go @@ -100,7 +100,7 @@ func CreateBlock() (Block, error) { } } timeVerificationTimestamp := time.Now() - if Env.Upgrades.Yangon <= len(Blockchain) { + if Env.Upgrades.Yangon <= len(Blockchain) && Env.Upgrades.Yangon != -1 { block.MiningTime = timeVerificationTimestamp.Sub(previousBlock.Timestamp.Add(previousBlock.MiningTime)) } else { block.MiningTime = time.Since(start) diff --git a/node_util/server.go b/node_util/server.go index a84fb62..0534870 100644 --- a/node_util/server.go +++ b/node_util/server.go @@ -267,9 +267,9 @@ func HandleVerifyTimeRequest(w http.ResponseWriter, req *http.Request) { // Get the time mining finished if Env.Upgrades.Yangon <= len(Blockchain) && Env.Upgrades.Yangon != -1 { previousBlockFinishedTime := Blockchain[len(Blockchain)-1].Timestamp.Add(Blockchain[len(Blockchain)-1].MiningTime) - currentTime = previousBlockFinishedTime.Add(block.MiningTime) + miningFinishedTime = previousBlockFinishedTime.Add(block.MiningTime) } else { - currentTime = block.Timestamp.Add(block.MiningTime) + miningFinishedTime = block.Timestamp.Add(block.MiningTime) } // Check if the time the block was mined is within a reasonable range of the current time // It cannot be in the future, and it cannot be more than 10 seconds in the past