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
afe83af2
Commit
afe83af2
authored
May 09, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved seeding and moved manifest
parent
5a0bae1d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
83 deletions
+80
-83
state.go
ethchain/state.go
+37
-10
state_manager.go
ethchain/state_manager.go
+0
-33
ethereum.go
ethereum.go
+43
-39
config.go
ethutil/config.go
+0
-1
No files found.
ethchain/state.go
View file @
afe83af2
...
@@ -116,16 +116,6 @@ func (s *State) Copy() *State {
...
@@ -116,16 +116,6 @@ func (s *State) Copy() *State {
return
NewState
(
s
.
trie
.
Copy
())
return
NewState
(
s
.
trie
.
Copy
())
}
}
type
ObjType
byte
const
(
NilTy
ObjType
=
iota
AccountTy
ContractTy
UnknownTy
)
// Updates any given state object
// Updates any given state object
func
(
s
*
State
)
UpdateStateObject
(
object
*
StateObject
)
{
func
(
s
*
State
)
UpdateStateObject
(
object
*
StateObject
)
{
addr
:=
object
.
Address
()
addr
:=
object
.
Address
()
...
@@ -145,3 +135,40 @@ func (s *State) Put(key, object []byte) {
...
@@ -145,3 +135,40 @@ func (s *State) Put(key, object []byte) {
func
(
s
*
State
)
Root
()
interface
{}
{
func
(
s
*
State
)
Root
()
interface
{}
{
return
s
.
trie
.
Root
return
s
.
trie
.
Root
}
}
// Object manifest
//
// The object manifest is used to keep changes to the state so we can keep track of the changes
// that occurred during a state transitioning phase.
type
Manifest
struct
{
// XXX These will be handy in the future. Not important for now.
objectAddresses
map
[
string
]
bool
storageAddresses
map
[
string
]
map
[
string
]
bool
objectChanges
map
[
string
]
*
StateObject
storageChanges
map
[
string
]
map
[
string
]
*
big
.
Int
}
func
NewManifest
()
*
Manifest
{
m
:=
&
Manifest
{
objectAddresses
:
make
(
map
[
string
]
bool
),
storageAddresses
:
make
(
map
[
string
]
map
[
string
]
bool
)}
m
.
Reset
()
return
m
}
func
(
m
*
Manifest
)
Reset
()
{
m
.
objectChanges
=
make
(
map
[
string
]
*
StateObject
)
m
.
storageChanges
=
make
(
map
[
string
]
map
[
string
]
*
big
.
Int
)
}
func
(
m
*
Manifest
)
AddObjectChange
(
stateObject
*
StateObject
)
{
m
.
objectChanges
[
string
(
stateObject
.
Address
())]
=
stateObject
}
func
(
m
*
Manifest
)
AddStorageChange
(
stateObject
*
StateObject
,
storageAddr
[]
byte
,
storage
*
big
.
Int
)
{
if
m
.
storageChanges
[
string
(
stateObject
.
Address
())]
==
nil
{
m
.
storageChanges
[
string
(
stateObject
.
Address
())]
=
make
(
map
[
string
]
*
big
.
Int
)
}
m
.
storageChanges
[
string
(
stateObject
.
Address
())][
string
(
storageAddr
)]
=
storage
}
ethchain/state_manager.go
View file @
afe83af2
...
@@ -331,36 +331,3 @@ func (sm *StateManager) notifyChanges() {
...
@@ -331,36 +331,3 @@ func (sm *StateManager) notifyChanges() {
}
}
}
}
}
}
type
Manifest
struct
{
// XXX These will be handy in the future. Not important for now.
objectAddresses
map
[
string
]
bool
storageAddresses
map
[
string
]
map
[
string
]
bool
objectChanges
map
[
string
]
*
StateObject
storageChanges
map
[
string
]
map
[
string
]
*
big
.
Int
}
func
NewManifest
()
*
Manifest
{
m
:=
&
Manifest
{
objectAddresses
:
make
(
map
[
string
]
bool
),
storageAddresses
:
make
(
map
[
string
]
map
[
string
]
bool
)}
m
.
Reset
()
return
m
}
func
(
m
*
Manifest
)
Reset
()
{
m
.
objectChanges
=
make
(
map
[
string
]
*
StateObject
)
m
.
storageChanges
=
make
(
map
[
string
]
map
[
string
]
*
big
.
Int
)
}
func
(
m
*
Manifest
)
AddObjectChange
(
stateObject
*
StateObject
)
{
m
.
objectChanges
[
string
(
stateObject
.
Address
())]
=
stateObject
}
func
(
m
*
Manifest
)
AddStorageChange
(
stateObject
*
StateObject
,
storageAddr
[]
byte
,
storage
*
big
.
Int
)
{
if
m
.
storageChanges
[
string
(
stateObject
.
Address
())]
==
nil
{
m
.
storageChanges
[
string
(
stateObject
.
Address
())]
=
make
(
map
[
string
]
*
big
.
Int
)
}
m
.
storageChanges
[
string
(
stateObject
.
Address
())][
string
(
storageAddr
)]
=
storage
}
ethereum.go
View file @
afe83af2
...
@@ -253,7 +253,7 @@ func (s *Ethereum) ReapDeadPeerHandler() {
...
@@ -253,7 +253,7 @@ func (s *Ethereum) ReapDeadPeerHandler() {
}
}
// Start the ethereum
// Start the ethereum
func
(
s
*
Ethereum
)
Start
()
{
func
(
s
*
Ethereum
)
Start
(
seed
bool
)
{
// Bind to addr and port
// Bind to addr and port
ln
,
err
:=
net
.
Listen
(
"tcp"
,
":"
+
s
.
Port
)
ln
,
err
:=
net
.
Listen
(
"tcp"
,
":"
+
s
.
Port
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -272,7 +272,12 @@ func (s *Ethereum) Start() {
...
@@ -272,7 +272,12 @@ func (s *Ethereum) Start() {
// Start the reaping processes
// Start the reaping processes
go
s
.
ReapDeadPeerHandler
()
go
s
.
ReapDeadPeerHandler
()
if
ethutil
.
Config
.
Seed
{
if
seed
{
s
.
Seed
()
}
}
func
(
s
*
Ethereum
)
Seed
()
{
ethutil
.
Config
.
Log
.
Debugln
(
"Seeding"
)
ethutil
.
Config
.
Log
.
Debugln
(
"Seeding"
)
// DNS Bootstrapping
// DNS Bootstrapping
_
,
nodes
,
err
:=
net
.
LookupSRV
(
"eth"
,
"tcp"
,
"ethereum.org"
)
_
,
nodes
,
err
:=
net
.
LookupSRV
(
"eth"
,
"tcp"
,
"ethereum.org"
)
...
@@ -313,7 +318,6 @@ func (s *Ethereum) Start() {
...
@@ -313,7 +318,6 @@ func (s *Ethereum) Start() {
s
.
ConnectToPeer
(
string
(
body
))
s
.
ConnectToPeer
(
string
(
body
))
}
}
}
}
}
func
(
s
*
Ethereum
)
peerHandler
(
listener
net
.
Listener
)
{
func
(
s
*
Ethereum
)
peerHandler
(
listener
net
.
Listener
)
{
...
...
ethutil/config.go
View file @
afe83af2
...
@@ -27,7 +27,6 @@ type config struct {
...
@@ -27,7 +27,6 @@ type config struct {
Ver
string
Ver
string
ClientString
string
ClientString
string
Pubkey
[]
byte
Pubkey
[]
byte
Seed
bool
}
}
var
Config
*
config
var
Config
*
config
...
...
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