diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2016-01-20 06:50:00 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2016-02-18 17:11:48 +0800 |
commit | b6d88a0e9f9aaeb47d585d79c768d457b545af90 (patch) | |
tree | 49e667cd929ce6b561961ac741d9ff0f82e61261 /core/block_validator.go | |
parent | 4f4d2b647488eaa056613fa6f026229ac91f066a (diff) | |
download | go-tangerine-b6d88a0e9f9aaeb47d585d79c768d457b545af90.tar go-tangerine-b6d88a0e9f9aaeb47d585d79c768d457b545af90.tar.gz go-tangerine-b6d88a0e9f9aaeb47d585d79c768d457b545af90.tar.bz2 go-tangerine-b6d88a0e9f9aaeb47d585d79c768d457b545af90.tar.lz go-tangerine-b6d88a0e9f9aaeb47d585d79c768d457b545af90.tar.xz go-tangerine-b6d88a0e9f9aaeb47d585d79c768d457b545af90.tar.zst go-tangerine-b6d88a0e9f9aaeb47d585d79c768d457b545af90.zip |
core, core/vm, crypto: fixes for homestead
* Removed some strange code that didn't apply state reverting properly
* Refactored code setting from vm & state transition to the executioner
* Updated tests
Diffstat (limited to 'core/block_validator.go')
-rw-r--r-- | core/block_validator.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/block_validator.go b/core/block_validator.go index 901744c61..73c33d8dd 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -117,8 +117,7 @@ func (v *BlockValidator) ValidateState(block, parent *types.Block, statedb *stat // For valid blocks this should always validate to true. rbloom := types.CreateBloom(receipts) if rbloom != header.Bloom { - //fmt.Printf("FUNKY: ValidateState: block number: %v\n", block.Number()) - return fmt.Errorf("unable to replicate block's bloom=%x", rbloom) + return fmt.Errorf("unable to replicate block's bloom=%x vs calculated bloom=%x", header.Bloom, rbloom) } // Tre receipt Trie's root (R = (Tr [[H1, R1], ... [Hn, R1]])) receiptSha := types.DeriveSha(receipts) @@ -270,10 +269,6 @@ func calcDifficultyHomestead(time, parentTime uint64, parentNumber, parentDiff * bigTime := new(big.Int).SetUint64(time) bigParentTime := new(big.Int).SetUint64(parentTime) - // for the exponential factor - periodCount := new(big.Int).Add(parentNumber, common.Big1) - periodCount.Div(periodCount, ExpDiffPeriod) - // holds intermediate values to make the algo easier to read & audit x := new(big.Int) y := new(big.Int) @@ -298,6 +293,10 @@ func calcDifficultyHomestead(time, parentTime uint64, parentNumber, parentDiff * x = params.MinimumDifficulty } + // for the exponential factor + periodCount := new(big.Int).Add(parentNumber, common.Big1) + periodCount.Div(periodCount, ExpDiffPeriod) + // the exponential factor, commonly refered to as "the bomb" // diff = diff + 2^(periodCount - 2) if periodCount.Cmp(common.Big1) > 0 { |