diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-16 18:27:38 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-16 18:27:38 +0800 |
commit | b5234413611ce5984292f85a01de1f56c045b490 (patch) | |
tree | e6e0c6f7fe8358a2dc63cdea11ac66b4f59397f5 /pow | |
parent | 0b8f66ed9ef177dc72442dd7ba337c6733e30344 (diff) | |
download | go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar.gz go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar.bz2 go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar.lz go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar.xz go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar.zst go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.zip |
Moved ethutil => common
Diffstat (limited to 'pow')
-rw-r--r-- | pow/dagger/dagger.go | 10 | ||||
-rw-r--r-- | pow/dagger/dagger_test.go | 4 | ||||
-rw-r--r-- | pow/ezp/pow.go | 6 |
3 files changed, 10 insertions, 10 deletions
diff --git a/pow/dagger/dagger.go b/pow/dagger/dagger.go index 3da7683d5..f2d65e8ef 100644 --- a/pow/dagger/dagger.go +++ b/pow/dagger/dagger.go @@ -7,7 +7,7 @@ import ( "time" "github.com/ethereum/go-ethereum/crypto/sha3" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/logger" ) @@ -50,7 +50,7 @@ func (dag *Dagger) Search(hash, diff *big.Int) ([]byte, []byte, []byte) { dag.hash = hash - obj := ethutil.BigPow(2, 256) + obj := common.BigPow(2, 256) obj = obj.Div(obj, diff) Found = false @@ -75,7 +75,7 @@ func (dag *Dagger) Search(hash, diff *big.Int) ([]byte, []byte, []byte) { func (dag *Dagger) Verify(hash, diff, nonce *big.Int) bool { dag.hash = hash - obj := ethutil.BigPow(2, 256) + obj := common.BigPow(2, 256) obj = obj.Div(obj, diff) return dag.Eval(nonce).Cmp(obj) < 0 @@ -85,7 +85,7 @@ func DaggerVerify(hash, diff, nonce *big.Int) bool { dagger := &Dagger{} dagger.hash = hash - obj := ethutil.BigPow(2, 256) + obj := common.BigPow(2, 256) obj = obj.Div(obj, diff) return dagger.Eval(nonce).Cmp(obj) < 0 @@ -133,7 +133,7 @@ func Sum(sha hash.Hash) []byte { } func (dag *Dagger) Eval(N *big.Int) *big.Int { - pow := ethutil.BigPow(2, 26) + pow := common.BigPow(2, 26) dag.xn = pow.Div(N, pow) sha := sha3.NewKeccak256() diff --git a/pow/dagger/dagger_test.go b/pow/dagger/dagger_test.go index f3a71d1eb..f53f4bac9 100644 --- a/pow/dagger/dagger_test.go +++ b/pow/dagger/dagger_test.go @@ -4,12 +4,12 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" ) func BenchmarkDaggerSearch(b *testing.B) { hash := big.NewInt(0) - diff := ethutil.BigPow(2, 36) + diff := common.BigPow(2, 36) o := big.NewInt(0) // nonce doesn't matter. We're only testing against speed, not validity // Reset timer so the big generation isn't included in the benchmark diff --git a/pow/ezp/pow.go b/pow/ezp/pow.go index 3ca502d06..7eba95784 100644 --- a/pow/ezp/pow.go +++ b/pow/ezp/pow.go @@ -7,7 +7,7 @@ import ( "time" "github.com/ethereum/go-ethereum/crypto/sha3" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/pow" ) @@ -91,8 +91,8 @@ func verify(hash []byte, diff *big.Int, nonce uint64) bool { d := append(hash, n...) sha.Write(d) - verification := new(big.Int).Div(ethutil.BigPow(2, 256), diff) - res := ethutil.BigD(sha.Sum(nil)) + verification := new(big.Int).Div(common.BigPow(2, 256), diff) + res := common.BigD(sha.Sum(nil)) return res.Cmp(verification) <= 0 } |