Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
1e241e84
G
go-ethereum
项目概览
whqwjb
/
go-ethereum
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
go-ethereum
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1e241e84
编写于
7月 26, 2015
作者:
J
Jeffrey Wilcke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
params: reduce extra data to 32 bytes
上级
73a576c9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
4 deletion
+13
-4
eth/backend.go
eth/backend.go
+3
-2
params/protocol_params.go
params/protocol_params.go
+2
-2
rpc/api/miner.go
rpc/api/miner.go
+8
-0
未找到文件。
eth/backend.go
浏览文件 @
1e241e84
...
...
@@ -45,6 +45,7 @@ import (
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/whisper"
)
...
...
@@ -370,8 +371,8 @@ func New(config *Config) (*Ethereum, error) {
eth
.
miner
.
SetGasPrice
(
config
.
GasPrice
)
extra
:=
config
.
Name
if
len
(
extra
)
>
1024
{
extra
=
extra
[
:
1024
]
if
uint64
(
len
(
extra
))
>
params
.
MaximumExtraDataSize
.
Uint64
()
{
extra
=
extra
[
:
params
.
MaximumExtraDataSize
.
Uint64
()
]
}
eth
.
miner
.
SetExtra
([]
byte
(
extra
))
...
...
params/protocol_params.go
浏览文件 @
1e241e84
...
...
@@ -22,7 +22,7 @@ package params
import
"math/big"
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.
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.
...
...
@@ -32,7 +32,7 @@ var (
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.
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.
LogDataGas
=
big
.
NewInt
(
8
)
// Per byte in a LOG* operation's data.
CallStipend
=
big
.
NewInt
(
2300
)
// Free gas given at beginning of call.
...
...
rpc/api/miner.go
浏览文件 @
1e241e84
...
...
@@ -17,9 +17,12 @@
package
api
import
(
"fmt"
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/common"
"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/shared"
)
...
...
@@ -122,6 +125,11 @@ func (self *minerApi) SetExtra(req *shared.Request) (interface{}, error) {
if
err
:=
self
.
codec
.
Decode
(
req
.
Params
,
&
args
);
err
!=
nil
{
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
))
return
true
,
nil
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录