aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/state_manager.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-09-16 04:11:05 +0800
committerobscuren <geffobscura@gmail.com>2014-09-16 04:11:05 +0800
commit399256b38403f2e95312250d49fca3cada8956b8 (patch)
tree25ee8bb6334377fb18a39463c8bd85ea7878f641 /ethchain/state_manager.go
parent33a0dec8a157b9687ca6038f4deb011f3f1f7bdc (diff)
downloadgo-tangerine-399256b38403f2e95312250d49fca3cada8956b8.tar
go-tangerine-399256b38403f2e95312250d49fca3cada8956b8.tar.gz
go-tangerine-399256b38403f2e95312250d49fca3cada8956b8.tar.bz2
go-tangerine-399256b38403f2e95312250d49fca3cada8956b8.tar.lz
go-tangerine-399256b38403f2e95312250d49fca3cada8956b8.tar.xz
go-tangerine-399256b38403f2e95312250d49fca3cada8956b8.tar.zst
go-tangerine-399256b38403f2e95312250d49fca3cada8956b8.zip
VM execution fixes
Refactoring caused executing issues
Diffstat (limited to 'ethchain/state_manager.go')
-rw-r--r--ethchain/state_manager.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go
index 1ccaa560f..b0ea754f4 100644
--- a/ethchain/state_manager.go
+++ b/ethchain/state_manager.go
@@ -5,6 +5,7 @@ import (
"container/list"
"fmt"
"math/big"
+ "os"
"sync"
"time"
@@ -154,6 +155,10 @@ done:
if i < len(block.Receipts()) {
original := block.Receipts()[i]
if !original.Cmp(receipt) {
+ if ethutil.Config.Diff {
+ os.Exit(1)
+ }
+
return nil, nil, nil, fmt.Errorf("err diff #%d (r) %v ~ %x <=> (c) %v ~ %x (%x)\n", i+1, original.CumulativeGasUsed, original.PostState[0:4], receipt.CumulativeGasUsed, receipt.PostState[0:4], receipt.Tx.Hash())
}
}
@@ -307,14 +312,16 @@ func (sm *StateManager) ValidateBlock(block *Block) error {
// Check each uncle's previous hash. In order for it to be valid
// is if it has the same block hash as the current
- previousBlock := sm.bc.GetBlock(block.PrevHash)
- for _, uncle := range block.Uncles {
- if bytes.Compare(uncle.PrevHash, previousBlock.PrevHash) != 0 {
- return ValidationError("Mismatch uncle's previous hash. Expected %x, got %x", previousBlock.PrevHash, uncle.PrevHash)
+ parent := sm.bc.GetBlock(block.PrevHash)
+ /*
+ for _, uncle := range block.Uncles {
+ if bytes.Compare(uncle.PrevHash,parent.PrevHash) != 0 {
+ return ValidationError("Mismatch uncle's previous hash. Expected %x, got %x",parent.PrevHash, uncle.PrevHash)
+ }
}
- }
+ */
- diff := block.Time - previousBlock.Time
+ diff := block.Time - parent.Time
if diff < 0 {
return ValidationError("Block timestamp less then prev block %v (%v - %v)", diff, block.Time, sm.bc.CurrentBlock.Time)
}