diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-02-22 20:10:07 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-02-23 18:16:44 +0800 |
commit | d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851 (patch) | |
tree | 17c93170551d3eeabe2935de1765f157007f0dc2 /vendor | |
parent | 47af53f9aaf9aa7b12cd976eb150ccf3d64da6fd (diff) | |
download | go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.gz go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.zst go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.zip |
all: blidly swap out glog to our log15, logs need rework
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/github.com/ethereum/ethash/ethash.go | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/vendor/github.com/ethereum/ethash/ethash.go b/vendor/github.com/ethereum/ethash/ethash.go index 2a31aaf2d..8e5cd8128 100644 --- a/vendor/github.com/ethereum/ethash/ethash.go +++ b/vendor/github.com/ethereum/ethash/ethash.go @@ -42,8 +42,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/pow" ) @@ -89,14 +88,14 @@ func (cache *cache) generate() { cache.gen.Do(func() { started := time.Now() seedHash := makeSeedHash(cache.epoch) - glog.V(logger.Debug).Infof("Generating cache for epoch %d (%x)", cache.epoch, seedHash) + log.Debug(fmt.Sprintf("Generating cache for epoch %d (%x)", cache.epoch, seedHash)) size := C.ethash_get_cachesize(C.uint64_t(cache.epoch * epochLength)) if cache.test { size = cacheSizeForTesting } cache.ptr = C.ethash_light_new_internal(size, (*C.ethash_h256_t)(unsafe.Pointer(&seedHash[0]))) runtime.SetFinalizer(cache, freeCache) - glog.V(logger.Debug).Infof("Done generating cache for epoch %d, it took %v", cache.epoch, time.Since(started)) + log.Debug(fmt.Sprintf("Done generating cache for epoch %d, it took %v", cache.epoch, time.Since(started))) }) } @@ -132,7 +131,7 @@ func (l *Light) Verify(block pow.Block) bool { // to prevent DOS attacks. blockNum := block.NumberU64() if blockNum >= epochLength*2048 { - glog.V(logger.Debug).Infof("block number %d too high, limit is %d", epochLength*2048) + log.Debug(fmt.Sprintf("block number %d too high, limit is %d", epochLength*2048)) return false } @@ -143,7 +142,7 @@ func (l *Light) Verify(block pow.Block) bool { Ethereum protocol consensus rules here which are not in scope of Ethash */ if difficulty.Cmp(common.Big0) == 0 { - glog.V(logger.Debug).Infof("invalid block difficulty") + log.Debug(fmt.Sprintf("invalid block difficulty")) return false } @@ -198,22 +197,22 @@ func (l *Light) getCache(blockNum uint64) *cache { evict = cache } } - glog.V(logger.Debug).Infof("Evicting DAG for epoch %d in favour of epoch %d", evict.epoch, epoch) + log.Debug(fmt.Sprintf("Evicting DAG for epoch %d in favour of epoch %d", evict.epoch, epoch)) delete(l.caches, evict.epoch) } // If we have the new DAG pre-generated, use that, otherwise create a new one if l.future != nil && l.future.epoch == epoch { - glog.V(logger.Debug).Infof("Using pre-generated DAG for epoch %d", epoch) + log.Debug(fmt.Sprintf("Using pre-generated DAG for epoch %d", epoch)) c, l.future = l.future, nil } else { - glog.V(logger.Debug).Infof("No pre-generated DAG available, creating new for epoch %d", epoch) + log.Debug(fmt.Sprintf("No pre-generated DAG available, creating new for epoch %d", epoch)) c = &cache{epoch: epoch, test: l.test} } l.caches[epoch] = c // If we just used up the future cache, or need a refresh, regenerate if l.future == nil || l.future.epoch <= epoch { - glog.V(logger.Debug).Infof("Pre-generating DAG for epoch %d", epoch+1) + log.Debug(fmt.Sprintf("Pre-generating DAG for epoch %d", epoch+1)) l.future = &cache{epoch: epoch + 1, test: l.test} go l.future.generate() } @@ -256,7 +255,7 @@ func (d *dag) generate() { if d.dir == "" { d.dir = DefaultDir } - glog.V(logger.Info).Infof("Generating DAG for epoch %d (size %d) (%x)", d.epoch, dagSize, seedHash) + log.Info(fmt.Sprintf("Generating DAG for epoch %d (size %d) (%x)", d.epoch, dagSize, seedHash)) // Generate a temporary cache. // TODO: this could share the cache with Light cache := C.ethash_light_new_internal(cacheSize, (*C.ethash_h256_t)(unsafe.Pointer(&seedHash[0]))) @@ -273,7 +272,7 @@ func (d *dag) generate() { panic("ethash_full_new IO or memory error") } runtime.SetFinalizer(d, freeDAG) - glog.V(logger.Info).Infof("Done generating DAG for epoch %d, it took %v", d.epoch, time.Since(started)) + log.Info(fmt.Sprintf("Done generating DAG for epoch %d, it took %v", d.epoch, time.Since(started))) }) } @@ -288,7 +287,7 @@ func (d *dag) Ptr() unsafe.Pointer { //export ethashGoCallback func ethashGoCallback(percent C.unsigned) C.int { - glog.V(logger.Info).Infof("Generating DAG: %d%%", percent) + log.Info(fmt.Sprintf("Generating DAG: %d%%", percent)) return 0 } |