OSDN Git Service

modify difficulty to 30s dev-mov-test
authoroys <oys@oysdeMacBook-Pro.local>
Wed, 26 Feb 2020 02:21:28 +0000 (10:21 +0800)
committeroys <oys@oysdeMacBook-Pro.local>
Wed, 26 Feb 2020 02:21:28 +0000 (10:21 +0800)
consensus/difficulty/difficulty.go
consensus/general.go

index c030ec6..125df16 100644 (file)
@@ -2,9 +2,9 @@ package difficulty
 
 import (
        "math/big"
+       "time"
 
        "github.com/bytom/bytom/consensus"
-       "github.com/bytom/bytom/mining/tensority"
        "github.com/bytom/bytom/protocol/bc"
        "github.com/bytom/bytom/protocol/bc/types"
 )
@@ -118,8 +118,9 @@ func BigToCompact(n *big.Int) uint64 {
 
 // CheckProofOfWork checks whether the hash is valid for a given difficulty.
 func CheckProofOfWork(hash, seed *bc.Hash, bits uint64) bool {
-       compareHash := tensority.AIHash.Hash(hash, seed)
-       return HashToBig(compareHash).Cmp(CompactToBig(bits)) <= 0
+       //compareHash := tensority.AIHash.Hash(hash, seed)
+       time.Sleep(30 * time.Second)
+       return true
 }
 
 // CalcNextRequiredDifficulty return the difficulty using compact representation
index 29ff67f..e0626e8 100644 (file)
@@ -24,7 +24,7 @@ const (
 
        // config for pow mining
        BlocksPerRetarget     = uint64(2016)
-       TargetSecondsPerBlock = uint64(150)
+       TargetSecondsPerBlock = uint64(30)
        SeedPerRetarget       = uint64(256)
 
        // MaxTimeOffsetSeconds is the maximum number of seconds a block time is allowed to be ahead of the current time