• R/O
  • HTTP
  • SSH
  • HTTPS

bytom: Commit

Official Go implementation of the Bytom protocol


Commit MetaInfo

Revision2bd6dd65d9937070e5cb4b2c26be86106bc4ee40 (tree)
Zeit2020-02-26 11:21:28
Autoroys <oys@oysd...>
Commiteroys

Log Message

modify difficulty to 30s

Ändern Zusammenfassung

Diff

--- a/consensus/difficulty/difficulty.go
+++ b/consensus/difficulty/difficulty.go
@@ -2,9 +2,9 @@ package difficulty
22
33 import (
44 "math/big"
5+ "time"
56
67 "github.com/bytom/bytom/consensus"
7- "github.com/bytom/bytom/mining/tensority"
88 "github.com/bytom/bytom/protocol/bc"
99 "github.com/bytom/bytom/protocol/bc/types"
1010 )
@@ -118,8 +118,9 @@ func BigToCompact(n *big.Int) uint64 {
118118
119119 // CheckProofOfWork checks whether the hash is valid for a given difficulty.
120120 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
123124 }
124125
125126 // CalcNextRequiredDifficulty return the difficulty using compact representation
--- a/consensus/general.go
+++ b/consensus/general.go
@@ -24,7 +24,7 @@ const (
2424
2525 // config for pow mining
2626 BlocksPerRetarget = uint64(2016)
27- TargetSecondsPerBlock = uint64(150)
27+ TargetSecondsPerBlock = uint64(30)
2828 SeedPerRetarget = uint64(256)
2929
3030 // MaxTimeOffsetSeconds is the maximum number of seconds a block time is allowed to be ahead of the current time
Show on old repository browser