diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-02 23:32:02 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-02 23:32:02 +0800 |
commit | b383ff0b96a1cf3df0b56f13b8d303ae4d4977ad (patch) | |
tree | 6af5b54d74402e2c31ea083981d215c0701832f4 /core/chain_manager.go | |
parent | 73c52d1677ba526385f1b223ef48f3a26091fe00 (diff) | |
download | dexon-b383ff0b96a1cf3df0b56f13b8d303ae4d4977ad.tar dexon-b383ff0b96a1cf3df0b56f13b8d303ae4d4977ad.tar.gz dexon-b383ff0b96a1cf3df0b56f13b8d303ae4d4977ad.tar.bz2 dexon-b383ff0b96a1cf3df0b56f13b8d303ae4d4977ad.tar.lz dexon-b383ff0b96a1cf3df0b56f13b8d303ae4d4977ad.tar.xz dexon-b383ff0b96a1cf3df0b56f13b8d303ae4d4977ad.tar.zst dexon-b383ff0b96a1cf3df0b56f13b8d303ae4d4977ad.zip |
New gas prices model
Diffstat (limited to 'core/chain_manager.go')
-rw-r--r-- | core/chain_manager.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go index 959bfd398..2f6c36382 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -28,11 +28,13 @@ type StateQuery interface { func CalcDifficulty(block, parent *types.Block) *big.Int { diff := new(big.Int) - adjust := new(big.Int).Rsh(parent.Difficulty(), 10) - if block.Time() >= parent.Time()+8 { - diff.Sub(parent.Difficulty(), adjust) - } else { + //adjust := new(big.Int).Rsh(parent.Difficulty(), 10) + //if block.Time() >= parent.Time()+8 { + adjust := new(big.Int).Div(parent.Difficulty(), big.NewInt(2048)) + if (block.Time() - parent.Time()) < 8 { diff.Add(parent.Difficulty(), adjust) + } else { + diff.Sub(parent.Difficulty(), adjust) } return diff |