aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-07-15 04:52:30 +0800
committerobscuren <geffobscura@gmail.com>2014-07-15 04:52:30 +0800
commit767d24ea5da8794dbc3b8bed19f6c204e775e406 (patch)
tree894122b95caa2fd2414bf810462ccd2b4171ca0a
parent5a0c4ce29509046e7de801e96bee893c82bfc1e8 (diff)
downloadgo-tangerine-767d24ea5da8794dbc3b8bed19f6c204e775e406.tar.gz
go-tangerine-767d24ea5da8794dbc3b8bed19f6c204e775e406.tar.zst
go-tangerine-767d24ea5da8794dbc3b8bed19f6c204e775e406.zip
Removed defer and added receipts checking in tx processing
-rw-r--r--ethchain/state_manager.go30
1 files changed, 5 insertions, 25 deletions
diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go
index f2ecd4b9f..d52e418ce 100644
--- a/ethchain/state_manager.go
+++ b/ethchain/state_manager.go
@@ -148,6 +148,11 @@ done:
accumelative := new(big.Int).Set(totalUsedGas.Add(totalUsedGas, txGas))
receipt := &Receipt{tx, ethutil.CopyBytes(state.Root().([]byte)), accumelative}
+ original := block.Receipts()[i]
+ if !original.Cmp(receipt) {
+ 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())
+ }
+
receipts = append(receipts, receipt)
handled = append(handled, tx)
@@ -192,31 +197,6 @@ func (sm *StateManager) Process(block *Block, dontReact bool) (err error) {
}
receipts, err := sm.ApplyDiff(state, parent, block)
- defer func() {
- if err != nil {
- if len(receipts) == len(block.Receipts()) {
- for i, receipt := range block.Receipts() {
- statelogger.Infof("diff (r) %v ~ %x <=> (c) %v ~ %x (%x)\n", receipt.CumulativeGasUsed, receipt.PostState[0:4], receipts[i].CumulativeGasUsed, receipts[i].PostState[0:4], receipt.Tx.Hash())
- }
- } else {
- statelogger.Warnln("Unable to print receipt diff. Length didn't match", len(receipts), "for", len(block.Receipts()))
- }
- } else {
- /*
- for i, receipt := range receipts {
- gu := new(big.Int)
- if i != 0 {
- gu.Sub(receipt.CumulativeGasUsed, receipts[i-1].CumulativeGasUsed)
- } else {
- gu.Set(receipt.CumulativeGasUsed)
- }
-
- statelogger.Infof("[r] %v ~ %x (%x)\n", gu, receipt.PostState[0:4], receipt.Tx.Hash())
- }
- */
- }
- }()
-
if err != nil {
return err
}