good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
92ffc1cc
Commit
92ffc1cc
authored
Jul 25, 2014
by
Jeffrey Wilcke
Browse files
Options
Downloads
Plain Diff
Merge branch 'release/0.6.0' into develop
parents
702cf5a3
54f9ea14
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ethvm/vm.go
+16
-27
16 additions, 27 deletions
ethvm/vm.go
peer.go
+25
-4
25 additions, 4 deletions
peer.go
with
41 additions
and
31 deletions
ethvm/vm.go
+
16
−
27
View file @
92ffc1cc
...
@@ -282,20 +282,15 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
...
@@ -282,20 +282,15 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
case
SDIV
:
case
SDIV
:
require
(
2
)
require
(
2
)
x
,
y
:=
stack
.
Popn
()
x
,
y
:=
stack
.
Popn
()
// n > 2**255
self
.
Printf
(
" %v / %v"
,
y
,
x
)
if
x
.
Cmp
(
Pow256
)
>
0
{
x
.
Sub
(
Pow256
,
x
)
if
x
.
Cmp
(
ethutil
.
Big0
)
!=
0
{
}
base
.
Div
(
y
,
x
)
if
y
.
Cmp
(
Pow256
)
>
0
{
y
.
Sub
(
Pow256
,
y
)
}
z
:=
new
(
big
.
Int
)
z
.
Div
(
x
,
y
)
if
z
.
Cmp
(
Pow256
)
>
0
{
z
.
Sub
(
Pow256
,
z
)
}
}
// Push result on to the stack
stack
.
Push
(
z
)
self
.
Printf
(
" = %v"
,
base
)
// Pop result back on the stack
stack
.
Push
(
base
)
case
MOD
:
case
MOD
:
require
(
2
)
require
(
2
)
x
,
y
:=
stack
.
Popn
()
x
,
y
:=
stack
.
Popn
()
...
@@ -309,20 +304,14 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
...
@@ -309,20 +304,14 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
case
SMOD
:
case
SMOD
:
require
(
2
)
require
(
2
)
x
,
y
:=
stack
.
Popn
()
x
,
y
:=
stack
.
Popn
()
// n > 2**255
if
x
.
Cmp
(
Pow256
)
>
0
{
self
.
Printf
(
" %v %% %v"
,
y
,
x
)
x
.
Sub
(
Pow256
,
x
)
}
base
.
Mod
(
y
,
x
)
if
y
.
Cmp
(
Pow256
)
>
0
{
y
.
Sub
(
Pow256
,
y
)
self
.
Printf
(
" = %v"
,
base
)
}
stack
.
Push
(
base
)
z
:=
new
(
big
.
Int
)
z
.
Mod
(
x
,
y
)
if
z
.
Cmp
(
Pow256
)
>
0
{
z
.
Sub
(
Pow256
,
z
)
}
// Push result on to the stack
stack
.
Push
(
z
)
case
EXP
:
case
EXP
:
require
(
2
)
require
(
2
)
x
,
y
:=
stack
.
Popn
()
x
,
y
:=
stack
.
Popn
()
...
...
This diff is collapsed.
Click to expand it.
peer.go
+
25
−
4
View file @
92ffc1cc
...
@@ -122,6 +122,7 @@ type Peer struct {
...
@@ -122,6 +122,7 @@ type Peer struct {
// Last received pong message
// Last received pong message
lastPong
int64
lastPong
int64
lastBlockReceived
time
.
Time
host
[]
byte
host
[]
byte
port
uint16
port
uint16
...
@@ -408,10 +409,7 @@ func (p *Peer) HandleInbound() {
...
@@ -408,10 +409,7 @@ func (p *Peer) HandleInbound() {
for
i
:=
msg
.
Data
.
Len
()
-
1
;
i
>=
0
;
i
--
{
for
i
:=
msg
.
Data
.
Len
()
-
1
;
i
>=
0
;
i
--
{
block
=
ethchain
.
NewBlockFromRlpValue
(
msg
.
Data
.
Get
(
i
))
block
=
ethchain
.
NewBlockFromRlpValue
(
msg
.
Data
.
Get
(
i
))
//p.ethereum.StateManager().PrepareDefault(block)
//state := p.ethereum.StateManager().CurrentState()
err
=
p
.
ethereum
.
StateManager
()
.
Process
(
block
,
false
)
err
=
p
.
ethereum
.
StateManager
()
.
Process
(
block
,
false
)
if
err
!=
nil
{
if
err
!=
nil
{
if
ethutil
.
Config
.
Debug
{
if
ethutil
.
Config
.
Debug
{
peerlogger
.
Infof
(
"Block %x failed
\n
"
,
block
.
Hash
())
peerlogger
.
Infof
(
"Block %x failed
\n
"
,
block
.
Hash
())
...
@@ -422,6 +420,8 @@ func (p *Peer) HandleInbound() {
...
@@ -422,6 +420,8 @@ func (p *Peer) HandleInbound() {
}
else
{
}
else
{
lastBlock
=
block
lastBlock
=
block
}
}
p
.
lastBlockReceived
=
time
.
Now
()
}
}
if
msg
.
Data
.
Len
()
<=
1
{
if
msg
.
Data
.
Len
()
<=
1
{
...
@@ -561,6 +561,25 @@ func (p *Peer) HandleInbound() {
...
@@ -561,6 +561,25 @@ func (p *Peer) HandleInbound() {
p
.
Stop
()
p
.
Stop
()
}
}
// General update method
func
(
self
*
Peer
)
update
()
{
serviceTimer
:=
time
.
NewTicker
(
5
*
time
.
Second
)
out
:
for
{
select
{
case
<-
serviceTimer
.
C
:
if
time
.
Since
(
self
.
lastBlockReceived
)
>
10
*
time
.
Second
{
self
.
catchingUp
=
false
}
case
<-
self
.
quit
:
break
out
}
}
serviceTimer
.
Stop
()
}
func
(
p
*
Peer
)
Start
()
{
func
(
p
*
Peer
)
Start
()
{
peerHost
,
peerPort
,
_
:=
net
.
SplitHostPort
(
p
.
conn
.
LocalAddr
()
.
String
())
peerHost
,
peerPort
,
_
:=
net
.
SplitHostPort
(
p
.
conn
.
LocalAddr
()
.
String
())
servHost
,
servPort
,
_
:=
net
.
SplitHostPort
(
p
.
conn
.
RemoteAddr
()
.
String
())
servHost
,
servPort
,
_
:=
net
.
SplitHostPort
(
p
.
conn
.
RemoteAddr
()
.
String
())
...
@@ -583,6 +602,8 @@ func (p *Peer) Start() {
...
@@ -583,6 +602,8 @@ func (p *Peer) Start() {
go
p
.
HandleOutbound
()
go
p
.
HandleOutbound
()
// Run the inbound handler in a new goroutine
// Run the inbound handler in a new goroutine
go
p
.
HandleInbound
()
go
p
.
HandleInbound
()
// Run the general update handler
go
p
.
update
()
// Wait a few seconds for startup and then ask for an initial ping
// Wait a few seconds for startup and then ask for an initial ping
time
.
Sleep
(
2
*
time
.
Second
)
time
.
Sleep
(
2
*
time
.
Second
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment