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
0b22ad99
Commit
0b22ad99
authored
Jun 25, 2015
by
Felix Lange
Committed by
Jeffrey Wilcke
Jun 29, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: optimize IntrinsicGas
parent
a8889b09
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
state_transition.go
core/state_transition.go
+12
-5
No files found.
core/state_transition.go
View file @
0b22ad99
...
...
@@ -77,12 +77,19 @@ func MessageGasValue(msg Message) *big.Int {
// with the given data.
func
IntrinsicGas
(
data
[]
byte
)
*
big
.
Int
{
igas
:=
new
(
big
.
Int
)
.
Set
(
params
.
TxGas
)
if
len
(
data
)
>
0
{
var
nz
int64
for
_
,
byt
:=
range
data
{
if
byt
!=
0
{
igas
.
Add
(
igas
,
params
.
TxDataNonZeroGas
)
}
else
{
igas
.
Add
(
igas
,
params
.
TxDataZeroGas
)
nz
++
}
}
m
:=
big
.
NewInt
(
nz
)
m
.
Mul
(
m
,
params
.
TxDataNonZeroGas
)
igas
.
Add
(
igas
,
m
)
m
.
SetInt64
(
int64
(
len
(
data
))
-
nz
)
m
.
Mul
(
m
,
params
.
TxDataZeroGas
)
igas
.
Add
(
igas
,
m
)
}
return
igas
}
...
...
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