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
8a5ea466
Commit
8a5ea466
authored
Jul 26, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1528 from obscuren/reduce-extra-data
params: reduce extra data to 32 bytes & target block time
parents
e86233ab
1e241e84
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
backend.go
eth/backend.go
+3
-2
protocol_params.go
params/protocol_params.go
+2
-2
miner.go
rpc/api/miner.go
+8
-0
No files found.
eth/backend.go
View file @
8a5ea466
...
@@ -45,6 +45,7 @@ import (
...
@@ -45,6 +45,7 @@ import (
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/whisper"
"github.com/ethereum/go-ethereum/whisper"
)
)
...
@@ -370,8 +371,8 @@ func New(config *Config) (*Ethereum, error) {
...
@@ -370,8 +371,8 @@ func New(config *Config) (*Ethereum, error) {
eth
.
miner
.
SetGasPrice
(
config
.
GasPrice
)
eth
.
miner
.
SetGasPrice
(
config
.
GasPrice
)
extra
:=
config
.
Name
extra
:=
config
.
Name
if
len
(
extra
)
>
1024
{
if
uint64
(
len
(
extra
))
>
params
.
MaximumExtraDataSize
.
Uint64
()
{
extra
=
extra
[
:
1024
]
extra
=
extra
[
:
params
.
MaximumExtraDataSize
.
Uint64
()
]
}
}
eth
.
miner
.
SetExtra
([]
byte
(
extra
))
eth
.
miner
.
SetExtra
([]
byte
(
extra
))
...
...
params/protocol_params.go
View file @
8a5ea466
...
@@ -22,7 +22,7 @@ package params
...
@@ -22,7 +22,7 @@ package params
import
"math/big"
import
"math/big"
var
(
var
(
MaximumExtraDataSize
=
big
.
NewInt
(
1024
)
// Maximum size extra data may be after Genesis.
MaximumExtraDataSize
=
big
.
NewInt
(
32
)
// Maximum size extra data may be after Genesis.
ExpByteGas
=
big
.
NewInt
(
10
)
// Times ceil(log256(exponent)) for the EXP instruction.
ExpByteGas
=
big
.
NewInt
(
10
)
// Times ceil(log256(exponent)) for the EXP instruction.
SloadGas
=
big
.
NewInt
(
50
)
// Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added.
SloadGas
=
big
.
NewInt
(
50
)
// Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added.
CallValueTransferGas
=
big
.
NewInt
(
9000
)
// Paid for CALL when the value transfor is non-zero.
CallValueTransferGas
=
big
.
NewInt
(
9000
)
// Paid for CALL when the value transfor is non-zero.
...
@@ -32,7 +32,7 @@ var (
...
@@ -32,7 +32,7 @@ var (
DifficultyBoundDivisor
=
big
.
NewInt
(
2048
)
// The bound divisor of the difficulty, used in the update calculations.
DifficultyBoundDivisor
=
big
.
NewInt
(
2048
)
// The bound divisor of the difficulty, used in the update calculations.
QuadCoeffDiv
=
big
.
NewInt
(
512
)
// Divisor for the quadratic particle of the memory cost equation.
QuadCoeffDiv
=
big
.
NewInt
(
512
)
// Divisor for the quadratic particle of the memory cost equation.
GenesisDifficulty
=
big
.
NewInt
(
131072
)
// Difficulty of the Genesis block.
GenesisDifficulty
=
big
.
NewInt
(
131072
)
// Difficulty of the Genesis block.
DurationLimit
=
big
.
NewInt
(
8
)
// The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
DurationLimit
=
big
.
NewInt
(
13
)
// The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
SstoreSetGas
=
big
.
NewInt
(
20000
)
// Once per SLOAD operation.
SstoreSetGas
=
big
.
NewInt
(
20000
)
// Once per SLOAD operation.
LogDataGas
=
big
.
NewInt
(
8
)
// Per byte in a LOG* operation's data.
LogDataGas
=
big
.
NewInt
(
8
)
// Per byte in a LOG* operation's data.
CallStipend
=
big
.
NewInt
(
2300
)
// Free gas given at beginning of call.
CallStipend
=
big
.
NewInt
(
2300
)
// Free gas given at beginning of call.
...
...
rpc/api/miner.go
View file @
8a5ea466
...
@@ -17,9 +17,12 @@
...
@@ -17,9 +17,12 @@
package
api
package
api
import
(
import
(
"fmt"
"github.com/ethereum/ethash"
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/shared"
"github.com/ethereum/go-ethereum/rpc/shared"
)
)
...
@@ -122,6 +125,11 @@ func (self *minerApi) SetExtra(req *shared.Request) (interface{}, error) {
...
@@ -122,6 +125,11 @@ func (self *minerApi) SetExtra(req *shared.Request) (interface{}, error) {
if
err
:=
self
.
codec
.
Decode
(
req
.
Params
,
&
args
);
err
!=
nil
{
if
err
:=
self
.
codec
.
Decode
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
if
uint64
(
len
(
args
.
Data
))
>
params
.
MaximumExtraDataSize
.
Uint64
()
*
2
{
return
false
,
fmt
.
Errorf
(
"extra datasize can be no longer than %v bytes"
,
params
.
MaximumExtraDataSize
)
}
self
.
ethereum
.
Miner
()
.
SetExtra
([]
byte
(
args
.
Data
))
self
.
ethereum
.
Miner
()
.
SetExtra
([]
byte
(
args
.
Data
))
return
true
,
nil
return
true
,
nil
}
}
...
...
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