Official Go implementation of the Bytom protocol
Revision | 2bd6dd65d9937070e5cb4b2c26be86106bc4ee40 (tree) |
---|---|
Zeit | 2020-02-26 11:21:28 |
Autor | oys <oys@oysd...> |
Commiter | oys |
modify difficulty to 30s
@@ -2,9 +2,9 @@ package difficulty | ||
2 | 2 | |
3 | 3 | import ( |
4 | 4 | "math/big" |
5 | + "time" | |
5 | 6 | |
6 | 7 | "github.com/bytom/bytom/consensus" |
7 | - "github.com/bytom/bytom/mining/tensority" | |
8 | 8 | "github.com/bytom/bytom/protocol/bc" |
9 | 9 | "github.com/bytom/bytom/protocol/bc/types" |
10 | 10 | ) |
@@ -118,8 +118,9 @@ func BigToCompact(n *big.Int) uint64 { | ||
118 | 118 | |
119 | 119 | // CheckProofOfWork checks whether the hash is valid for a given difficulty. |
120 | 120 | func CheckProofOfWork(hash, seed *bc.Hash, bits uint64) bool { |
121 | - compareHash := tensority.AIHash.Hash(hash, seed) | |
122 | - return HashToBig(compareHash).Cmp(CompactToBig(bits)) <= 0 | |
121 | + //compareHash := tensority.AIHash.Hash(hash, seed) | |
122 | + time.Sleep(30 * time.Second) | |
123 | + return true | |
123 | 124 | } |
124 | 125 | |
125 | 126 | // CalcNextRequiredDifficulty return the difficulty using compact representation |
@@ -24,7 +24,7 @@ const ( | ||
24 | 24 | |
25 | 25 | // config for pow mining |
26 | 26 | BlocksPerRetarget = uint64(2016) |
27 | - TargetSecondsPerBlock = uint64(150) | |
27 | + TargetSecondsPerBlock = uint64(30) | |
28 | 28 | SeedPerRetarget = uint64(256) |
29 | 29 | |
30 | 30 | // MaxTimeOffsetSeconds is the maximum number of seconds a block time is allowed to be ahead of the current time |