Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
27290e12
Commit
27290e12
authored
Aug 09, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed gas limit calculation
parent
c51db4c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
block.go
ethchain/block.go
+4
-2
No files found.
ethchain/block.go
View file @
27290e12
...
@@ -130,8 +130,10 @@ func (block *Block) CalcGasLimit(parent *Block) *big.Int {
...
@@ -130,8 +130,10 @@ func (block *Block) CalcGasLimit(parent *Block) *big.Int {
return
ethutil
.
BigPow
(
10
,
6
)
return
ethutil
.
BigPow
(
10
,
6
)
}
}
previous
:=
new
(
big
.
Int
)
.
Mul
(
big
.
NewInt
(
1023
),
parent
.
GasLimit
)
// ((1024-1) * parent.gasLimit + (gasUsed * 6 / 5)) / 1024
current
:=
new
(
big
.
Rat
)
.
Mul
(
new
(
big
.
Rat
)
.
SetInt
(
block
.
GasUsed
),
big
.
NewRat
(
6
,
5
))
previous
:=
new
(
big
.
Int
)
.
Mul
(
big
.
NewInt
(
1024
-
1
),
parent
.
GasLimit
)
current
:=
new
(
big
.
Rat
)
.
Mul
(
new
(
big
.
Rat
)
.
SetInt
(
parent
.
GasUsed
),
big
.
NewRat
(
6
,
5
))
curInt
:=
new
(
big
.
Int
)
.
Div
(
current
.
Num
(),
current
.
Denom
())
curInt
:=
new
(
big
.
Int
)
.
Div
(
current
.
Num
(),
current
.
Denom
())
result
:=
new
(
big
.
Int
)
.
Add
(
previous
,
curInt
)
result
:=
new
(
big
.
Int
)
.
Add
(
previous
,
curInt
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment