Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
aad48900
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,体验更适合开发者的 AI 搜索 >>
提交
aad48900
编写于
11月 20, 2016
作者:
J
Jeffrey Wilcke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cmd/geth, core, light, mobile: removed state account StartingNonce
All account's nonce start at 0.
上级
a0e42aa4
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
5 addition
and
33 deletion
+5
-33
cmd/geth/chaincmd.go
cmd/geth/chaincmd.go
+0
-3
cmd/geth/main.go
cmd/geth/main.go
+0
-5
cmd/utils/flags.go
cmd/utils/flags.go
+0
-3
core/genesis.go
core/genesis.go
+2
-2
core/state/statedb.go
core/state/statedb.go
+2
-6
light/state.go
light/state.go
+1
-4
mobile/geth.go
mobile/geth.go
+0
-10
未找到文件。
cmd/geth/chaincmd.go
浏览文件 @
aad48900
...
...
@@ -99,9 +99,6 @@ func importChain(ctx *cli.Context) error {
if
len
(
ctx
.
Args
())
!=
1
{
utils
.
Fatalf
(
"This command requires an argument."
)
}
if
ctx
.
GlobalBool
(
utils
.
TestNetFlag
.
Name
)
{
state
.
StartingNonce
=
1048576
// (2**20)
}
stack
:=
makeFullNode
(
ctx
)
chain
,
chainDb
:=
utils
.
MakeChain
(
ctx
,
stack
)
defer
chainDb
.
Close
()
...
...
cmd/geth/main.go
浏览文件 @
aad48900
...
...
@@ -34,7 +34,6 @@ import (
"github.com/ethereum/go-ethereum/console"
"github.com/ethereum/go-ethereum/contracts/release"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/internal/debug"
"github.com/ethereum/go-ethereum/logger"
...
...
@@ -237,10 +236,6 @@ func initGenesis(ctx *cli.Context) error {
utils
.
Fatalf
(
"must supply path to genesis JSON file"
)
}
if
ctx
.
GlobalBool
(
utils
.
TestNetFlag
.
Name
)
{
state
.
StartingNonce
=
1048576
// (2**20)
}
stack
:=
makeFullNode
(
ctx
)
chaindb
:=
utils
.
MakeChainDatabase
(
ctx
,
stack
)
...
...
cmd/utils/flags.go
浏览文件 @
aad48900
...
...
@@ -38,7 +38,6 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/les"
"github.com/ethereum/go-ethereum/light"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/metrics"
...
...
@@ -754,8 +753,6 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) {
ethConf
.
NetworkId
=
2
}
ethConf
.
Genesis
=
core
.
TestNetGenesisBlock
()
state
.
StartingNonce
=
1048576
// (2**20)
light
.
StartingNonce
=
1048576
// (2**20)
case
ctx
.
GlobalBool
(
DevModeFlag
.
Name
)
:
ethConf
.
Genesis
=
core
.
OlympicGenesisBlock
()
...
...
core/genesis.go
浏览文件 @
aad48900
...
...
@@ -43,7 +43,7 @@ func WriteGenesisBlock(chainDb ethdb.Database, reader io.Reader) (*types.Block,
}
var
genesis
struct
{
ChainConfig
*
params
.
ChainConfig
`json:"config"`
ChainConfig
params
.
ChainConfig
`json:"config"`
Nonce
string
Timestamp
string
ParentHash
string
...
...
@@ -115,7 +115,7 @@ func WriteGenesisBlock(chainDb ethdb.Database, reader io.Reader) (*types.Block,
if
err
:=
WriteHeadBlockHash
(
chainDb
,
block
.
Hash
());
err
!=
nil
{
return
nil
,
err
}
if
err
:=
WriteChainConfig
(
chainDb
,
block
.
Hash
(),
genesis
.
ChainConfig
);
err
!=
nil
{
if
err
:=
WriteChainConfig
(
chainDb
,
block
.
Hash
(),
&
genesis
.
ChainConfig
);
err
!=
nil
{
return
nil
,
err
}
...
...
core/state/statedb.go
浏览文件 @
aad48900
...
...
@@ -34,10 +34,6 @@ import (
lru
"github.com/hashicorp/golang-lru"
)
// The starting nonce determines the default nonce when new accounts are being
// created.
var
StartingNonce
uint64
// Trie cache generation limit after which to evic trie nodes from memory.
var
MaxTrieCacheGen
=
uint16
(
120
)
...
...
@@ -239,7 +235,7 @@ func (self *StateDB) GetNonce(addr common.Address) uint64 {
return
stateObject
.
Nonce
()
}
return
StartingNonce
return
0
}
func
(
self
*
StateDB
)
GetCode
(
addr
common
.
Address
)
[]
byte
{
...
...
@@ -423,7 +419,7 @@ func (self *StateDB) MarkStateObjectDirty(addr common.Address) {
func
(
self
*
StateDB
)
createObject
(
addr
common
.
Address
)
(
newobj
,
prev
*
StateObject
)
{
prev
=
self
.
GetStateObject
(
addr
)
newobj
=
newObject
(
self
,
addr
,
Account
{},
self
.
MarkStateObjectDirty
)
newobj
.
setNonce
(
StartingNonce
)
// sets the object to dirty
newobj
.
setNonce
(
0
)
// sets the object to dirty
if
prev
==
nil
{
if
glog
.
V
(
logger
.
Core
)
{
glog
.
Infof
(
"(+) %x
\n
"
,
addr
)
...
...
light/state.go
浏览文件 @
aad48900
...
...
@@ -26,9 +26,6 @@ import (
"golang.org/x/net/context"
)
// StartingNonce determines the default nonce when new accounts are being created.
var
StartingNonce
uint64
// LightState is a memory representation of a state.
// This version is ODR capable, caching only the already accessed part of the
// state, retrieving unknown parts on-demand from the ODR backend. Changes are
...
...
@@ -238,7 +235,7 @@ func (self *LightState) newStateObject(addr common.Address) *StateObject {
}
stateObject
:=
NewStateObject
(
addr
,
self
.
odr
)
stateObject
.
SetNonce
(
StartingNonce
)
stateObject
.
SetNonce
(
0
)
self
.
stateObjects
[
addr
.
Str
()]
=
stateObject
return
stateObject
...
...
mobile/geth.go
浏览文件 @
aad48900
...
...
@@ -25,11 +25,9 @@ import (
"path/filepath"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/les"
"github.com/ethereum/go-ethereum/light"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/params"
...
...
@@ -63,10 +61,6 @@ type NodeConfig struct {
// empty genesis state is equivalent to using the mainnet's state.
EthereumGenesis
string
// EthereumTestnetNonces specifies whether to use account nonces from the testnet
// range (2^20) or from the mainnet one (0).
EthereumTestnetNonces
bool
// EthereumDatabaseCache is the system memory in MB to allocate for database caching.
// A minimum of 16MB is always reserved.
EthereumDatabaseCache
int
...
...
@@ -151,10 +145,6 @@ func NewNode(datadir string, config *NodeConfig) (*Node, error) {
GpobaseStepUp
:
100
,
GpobaseCorrectionFactor
:
110
,
}
if
config
.
EthereumTestnetNonces
{
state
.
StartingNonce
=
1048576
// (2**20)
light
.
StartingNonce
=
1048576
// (2**20)
}
if
err
:=
stack
.
Register
(
func
(
ctx
*
node
.
ServiceContext
)
(
node
.
Service
,
error
)
{
return
les
.
New
(
ctx
,
ethConf
)
});
err
!=
nil
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录