mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
more debugging
This commit is contained in:
parent
b1756c4312
commit
1613e1d884
2 changed files with 10 additions and 0 deletions
|
|
@ -548,6 +548,14 @@ func (ethash *Ethash) verifySeal(chain consensus.ChainReader, header *types.Head
|
||||||
ctx = append(ctx, "sealHash", fmt.Sprintf("%x", sealHash))
|
ctx = append(ctx, "sealHash", fmt.Sprintf("%x", sealHash))
|
||||||
digest, result = hashimotoLight(size, cache.cache, sealHash, nonce)
|
digest, result = hashimotoLight(size, cache.cache, sealHash, nonce)
|
||||||
ctx = append(ctx, "result", fmt.Sprintf("%x", result))
|
ctx = append(ctx, "result", fmt.Sprintf("%x", result))
|
||||||
|
ctx = append(ctx, "epoch", cache.epoch)
|
||||||
|
// For debuggging only
|
||||||
|
sum := uint32(0)
|
||||||
|
for _, val := range cache.cache {
|
||||||
|
sum = sum ^ val
|
||||||
|
}
|
||||||
|
ctx = append(ctx, "cachexor", fmt.Sprintf("%x", sum))
|
||||||
|
|
||||||
// Caches are unmapped in a finalizer. Ensure that the cache stays alive
|
// Caches are unmapped in a finalizer. Ensure that the cache stays alive
|
||||||
// until after the call to hashimotoLight so it's not unmapped while being used.
|
// until after the call to hashimotoLight so it's not unmapped while being used.
|
||||||
runtime.KeepAlive(cache)
|
runtime.KeepAlive(cache)
|
||||||
|
|
@ -556,6 +564,7 @@ func (ethash *Ethash) verifySeal(chain consensus.ChainReader, header *types.Head
|
||||||
if !bytes.Equal(header.MixDigest[:], digest) {
|
if !bytes.Equal(header.MixDigest[:], digest) {
|
||||||
ctx = append(ctx, "digest", fmt.Sprintf("%x", digest))
|
ctx = append(ctx, "digest", fmt.Sprintf("%x", digest))
|
||||||
ctx = append(ctx, "hdr.digest", fmt.Sprintf("%x", header.MixDigest[:]))
|
ctx = append(ctx, "hdr.digest", fmt.Sprintf("%x", header.MixDigest[:]))
|
||||||
|
|
||||||
log.Error("Invalid mix digest", ctx...)
|
log.Error("Invalid mix digest", ctx...)
|
||||||
return errInvalidMixDigest
|
return errInvalidMixDigest
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -197,6 +197,7 @@ func TestEthashVerification(t *testing.T) {
|
||||||
)
|
)
|
||||||
cache := engine.cache(number)
|
cache := engine.cache(number)
|
||||||
size := datasetSize(number)
|
size := datasetSize(number)
|
||||||
|
fmt.Printf("number: %d\n", number)
|
||||||
fmt.Printf("datasetSize: %d\n", size)
|
fmt.Printf("datasetSize: %d\n", size)
|
||||||
digest, result := hashimotoLight(size, cache.cache, sealHash, nonce)
|
digest, result := hashimotoLight(size, cache.cache, sealHash, nonce)
|
||||||
fmt.Printf("nonce: %v\n", nonce)
|
fmt.Printf("nonce: %v\n", nonce)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue