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
18d1569c
Commit
18d1569c
authored
Mar 25, 2015
by
zelig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
header check for test
parent
9d592c04
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
blockpool.go
blockpool/blockpool.go
+5
-1
peers_test.go
blockpool/peers_test.go
+3
-2
No files found.
blockpool/blockpool.go
View file @
18d1569c
...
...
@@ -238,7 +238,11 @@ func (self *BlockPool) Start() {
case
event
:=
<-
self
.
tdSub
.
Chan
()
:
if
ev
,
ok
:=
event
.
(
core
.
ChainHeadEvent
);
ok
{
td
:=
ev
.
Block
.
Td
plog
.
DebugDetailf
(
"ChainHeadEvent: height: %v, td: %v, hash: %s"
,
ev
.
Block
.
Number
(),
td
,
hex
(
ev
.
Block
.
Hash
()))
var
height
*
big
.
Int
if
(
ev
.
Block
.
HeaderHash
==
common
.
Hash
{})
{
height
=
ev
.
Block
.
Header
()
.
Number
}
plog
.
DebugDetailf
(
"ChainHeadEvent: height: %v, td: %v, hash: %s"
,
height
,
td
,
hex
(
ev
.
Block
.
Hash
()))
self
.
setTD
(
td
)
self
.
peers
.
lock
.
Lock
()
...
...
blockpool/peers_test.go
View file @
18d1569c
...
...
@@ -14,7 +14,7 @@ import (
// the actual tests
func
TestAddPeer
(
t
*
testing
.
T
)
{
test
.
LogInit
()
_
,
blockPool
,
blockPoolTester
:=
newTestBlockPool
(
t
)
hashPool
,
blockPool
,
blockPoolTester
:=
newTestBlockPool
(
t
)
peer0
:=
blockPoolTester
.
newPeer
(
"peer0"
,
1
,
1
)
peer1
:=
blockPoolTester
.
newPeer
(
"peer1"
,
2
,
2
)
peer2
:=
blockPoolTester
.
newPeer
(
"peer2"
,
3
,
3
)
...
...
@@ -119,7 +119,8 @@ func TestAddPeer(t *testing.T) {
}
peer0
.
waitBlocksRequests
(
3
)
newblock
:=
&
types
.
Block
{
Td
:
common
.
Big3
}
hash
:=
hashPool
.
IndexesToHashes
([]
int
{
0
})[
0
]
newblock
:=
&
types
.
Block
{
Td
:
common
.
Big3
,
HeaderHash
:
hash
}
blockPool
.
chainEvents
.
Post
(
core
.
ChainHeadEvent
{
newblock
})
time
.
Sleep
(
100
*
time
.
Millisecond
)
if
blockPool
.
peers
.
best
!=
nil
{
...
...
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