Commit 8c7e6222 authored by George Hotz's avatar George Hotz Committed by GitHub

Merge pull request #11 from han0110/fix/missing-difficulty

Fix: set missing difficulty in block header
parents 3b40aa6c 6ed64003
This diff is collapsed.
...@@ -68,6 +68,8 @@ func main() { ...@@ -68,6 +68,8 @@ func main() {
processor := core.NewStateProcessor(params.MainnetChainConfig, bc, bc.Engine()) processor := core.NewStateProcessor(params.MainnetChainConfig, bc, bc.Engine())
fmt.Println("processing state:", parent.Number, "->", newheader.Number) fmt.Println("processing state:", parent.Number, "->", newheader.Number)
newheader.Difficulty = bc.Engine().CalcDifficulty(bc, newheader.Time, &parent)
// read txs // read txs
//traverseStackTrie(newheader.TxHash) //traverseStackTrie(newheader.TxHash)
......
...@@ -197,7 +197,7 @@ func Output(output common.Hash) { ...@@ -197,7 +197,7 @@ func Output(output common.Hash) {
if output == inputs[6] { if output == inputs[6] {
fmt.Println("good transition") fmt.Println("good transition")
} else { } else {
fmt.Println(output, "!=", inputs[5]) fmt.Println(output, "!=", inputs[6])
panic("BAD transition :((") panic("BAD transition :((")
} }
} }
......
...@@ -21,7 +21,7 @@ func Preimage(hash common.Hash) []byte { ...@@ -21,7 +21,7 @@ func Preimage(hash common.Hash) []byte {
fmt.Println("can't find preimage", hash) fmt.Println("can't find preimage", hash)
} }
comphash := crypto.Keccak256Hash(val) comphash := crypto.Keccak256Hash(val)
if hash != comphash { if ok && hash != comphash {
panic("corruption in hash " + hash.String()) panic("corruption in hash " + hash.String())
} }
return val return val
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment