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
9ed8dc73
Commit
9ed8dc73
authored
Sep 25, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attempt to catch up from unknown block
parent
2458697d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
block_pool.go
block_pool.go
+5
-0
js_types.go
ethpipe/js_types.go
+10
-2
peer.go
peer.go
+0
-1
No files found.
block_pool.go
View file @
9ed8dc73
...
@@ -73,6 +73,10 @@ func (self *BlockPool) SetBlock(b *ethchain.Block, peer *Peer) {
...
@@ -73,6 +73,10 @@ func (self *BlockPool) SetBlock(b *ethchain.Block, peer *Peer) {
if
self
.
pool
[
hash
]
==
nil
&&
!
self
.
eth
.
BlockChain
()
.
HasBlock
(
b
.
Hash
())
{
if
self
.
pool
[
hash
]
==
nil
&&
!
self
.
eth
.
BlockChain
()
.
HasBlock
(
b
.
Hash
())
{
self
.
hashPool
=
append
(
self
.
hashPool
,
b
.
Hash
())
self
.
hashPool
=
append
(
self
.
hashPool
,
b
.
Hash
())
self
.
pool
[
hash
]
=
&
block
{
peer
,
peer
,
b
,
time
.
Now
(),
0
}
self
.
pool
[
hash
]
=
&
block
{
peer
,
peer
,
b
,
time
.
Now
(),
0
}
if
!
self
.
eth
.
BlockChain
()
.
HasBlock
(
b
.
PrevHash
)
&&
self
.
pool
[
string
(
b
.
PrevHash
)]
==
nil
{
peer
.
QueueMessage
(
ethwire
.
NewMessage
(
ethwire
.
MsgGetBlockHashesTy
,
[]
interface
{}{
b
.
PrevHash
,
uint32
(
256
)}))
}
}
else
if
self
.
pool
[
hash
]
!=
nil
{
}
else
if
self
.
pool
[
hash
]
!=
nil
{
self
.
pool
[
hash
]
.
block
=
b
self
.
pool
[
hash
]
.
block
=
b
}
}
...
@@ -218,6 +222,7 @@ out:
...
@@ -218,6 +222,7 @@ out:
case
<-
procTimer
.
C
:
case
<-
procTimer
.
C
:
// XXX We can optimize this lifting this on to a new goroutine.
// XXX We can optimize this lifting this on to a new goroutine.
// We'd need to make sure that the pools are properly protected by a mutex
// We'd need to make sure that the pools are properly protected by a mutex
// XXX This should moved in The Great Refactor(TM)
amount
:=
self
.
ProcessCanonical
(
func
(
block
*
ethchain
.
Block
)
{
amount
:=
self
.
ProcessCanonical
(
func
(
block
*
ethchain
.
Block
)
{
err
:=
self
.
eth
.
StateManager
()
.
Process
(
block
,
false
)
err
:=
self
.
eth
.
StateManager
()
.
Process
(
block
,
false
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
ethpipe/js_types.go
View file @
9ed8dc73
...
@@ -23,12 +23,13 @@ type JSBlock struct {
...
@@ -23,12 +23,13 @@ type JSBlock struct {
Name
string
`json:"name"`
Name
string
`json:"name"`
GasLimit
string
`json:"gasLimit"`
GasLimit
string
`json:"gasLimit"`
GasUsed
string
`json:"gasUsed"`
GasUsed
string
`json:"gasUsed"`
PrevHash
string
`json:"prevHash"`
}
}
// Creates a new QML Block from a chain block
// Creates a new QML Block from a chain block
func
NewJSBlock
(
block
*
ethchain
.
Block
)
*
JSBlock
{
func
NewJSBlock
(
block
*
ethchain
.
Block
)
*
JSBlock
{
if
block
==
nil
{
if
block
==
nil
{
return
nil
return
&
JSBlock
{}
}
}
var
ptxs
[]
JSTransaction
var
ptxs
[]
JSTransaction
...
@@ -38,7 +39,14 @@ func NewJSBlock(block *ethchain.Block) *JSBlock {
...
@@ -38,7 +39,14 @@ func NewJSBlock(block *ethchain.Block) *JSBlock {
list
:=
ethutil
.
NewList
(
ptxs
)
list
:=
ethutil
.
NewList
(
ptxs
)
return
&
JSBlock
{
ref
:
block
,
Size
:
block
.
Size
()
.
String
(),
Number
:
int
(
block
.
Number
.
Uint64
()),
GasUsed
:
block
.
GasUsed
.
String
(),
GasLimit
:
block
.
GasLimit
.
String
(),
Hash
:
ethutil
.
Bytes2Hex
(
block
.
Hash
()),
Transactions
:
list
,
Time
:
block
.
Time
,
Coinbase
:
ethutil
.
Bytes2Hex
(
block
.
Coinbase
)}
return
&
JSBlock
{
ref
:
block
,
Size
:
block
.
Size
()
.
String
(),
Number
:
int
(
block
.
Number
.
Uint64
()),
GasUsed
:
block
.
GasUsed
.
String
(),
GasLimit
:
block
.
GasLimit
.
String
(),
Hash
:
ethutil
.
Bytes2Hex
(
block
.
Hash
()),
Transactions
:
list
,
Time
:
block
.
Time
,
Coinbase
:
ethutil
.
Bytes2Hex
(
block
.
Coinbase
),
PrevHash
:
ethutil
.
Bytes2Hex
(
block
.
PrevHash
),
}
}
}
func
(
self
*
JSBlock
)
ToString
()
string
{
func
(
self
*
JSBlock
)
ToString
()
string
{
...
...
peer.go
View file @
9ed8dc73
...
@@ -221,7 +221,6 @@ func (self *Peer) Connect(addr string) (conn net.Conn, err error) {
...
@@ -221,7 +221,6 @@ func (self *Peer) Connect(addr string) (conn net.Conn, err error) {
for
attempts
:=
0
;
attempts
<
maxTries
;
attempts
++
{
for
attempts
:=
0
;
attempts
<
maxTries
;
attempts
++
{
conn
,
err
=
net
.
DialTimeout
(
"tcp"
,
addr
,
10
*
time
.
Second
)
conn
,
err
=
net
.
DialTimeout
(
"tcp"
,
addr
,
10
*
time
.
Second
)
if
err
!=
nil
{
if
err
!=
nil
{
//peerlogger.Debugf("Peer connection failed. Retrying (%d/%d) (%s)\n", attempts+1, maxTries, addr)
time
.
Sleep
(
time
.
Duration
(
attempts
*
20
)
*
time
.
Second
)
time
.
Sleep
(
time
.
Duration
(
attempts
*
20
)
*
time
.
Second
)
continue
continue
}
}
...
...
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