aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-11-04 18:04:02 +0800
committerobscuren <geffobscura@gmail.com>2014-11-04 18:04:02 +0800
commitf4b717cb9da6113304f243caea6a3799a1aeecf3 (patch)
treec26eea3def5379f6a87f1302d519aac08d3ecb07
parentf59a3b67f69b26f969084e0de165435e80bd8e12 (diff)
downloaddexon-f4b717cb9da6113304f243caea6a3799a1aeecf3.tar
dexon-f4b717cb9da6113304f243caea6a3799a1aeecf3.tar.gz
dexon-f4b717cb9da6113304f243caea6a3799a1aeecf3.tar.bz2
dexon-f4b717cb9da6113304f243caea6a3799a1aeecf3.tar.lz
dexon-f4b717cb9da6113304f243caea6a3799a1aeecf3.tar.xz
dexon-f4b717cb9da6113304f243caea6a3799a1aeecf3.tar.zst
dexon-f4b717cb9da6113304f243caea6a3799a1aeecf3.zip
Bloom validation
-rw-r--r--chain/block_manager.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/chain/block_manager.go b/chain/block_manager.go
index 998b1705d..1a5e3aeb3 100644
--- a/chain/block_manager.go
+++ b/chain/block_manager.go
@@ -3,6 +3,7 @@ package chain
import (
"bytes"
"container/list"
+ "errors"
"fmt"
"math/big"
"os"
@@ -168,7 +169,6 @@ done:
erroneous = append(erroneous, tx)
err = nil
continue
- //return nil, nil, nil, err
}
}
@@ -177,7 +177,6 @@ done:
txGas.Sub(txGas, st.gas)
cumulative := new(big.Int).Set(totalUsedGas.Add(totalUsedGas, txGas))
- //receipt := &Receipt{tx, ethutil.CopyBytes(state.Root().([]byte)), accumelative}
receipt := &Receipt{ethutil.CopyBytes(state.Root().([]byte)), cumulative, LogsBloom(state.Logs()).Bytes(), state.Logs()}
if i < len(block.Receipts()) {
@@ -254,8 +253,6 @@ func (sm *BlockManager) Process(block *Block) (err error) {
return fmt.Errorf("Error validating receipt sha. Received %x, got %x", block.ReceiptSha, receiptSha)
}
- // TODO validate bloom
-
// Block validation
if err = sm.ValidateBlock(block); err != nil {
statelogger.Errorln("Error validating block:", err)
@@ -267,6 +264,10 @@ func (sm *BlockManager) Process(block *Block) (err error) {
return err
}
+ if bytes.Compare(CreateBloom(block), block.LogsBloom) != 0 {
+ return errors.New("Unable to replicate block's bloom")
+ }
+
state.Update()
if !block.State().Cmp(state) {