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
b136b387
Commit
b136b387
authored
Jan 09, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ethersphere-develop' into develop
parents
6eb45503
a35be3a1
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
500 additions
and
191 deletions
+500
-191
chain_manager.go
core/chain_manager.go
+1
-3
block_pool.go
eth/block_pool.go
+350
-117
block_pool_test.go
eth/block_pool_test.go
+139
-53
error.go
eth/error.go
+2
-0
protocol.go
eth/protocol.go
+0
-10
02.sh
eth/test/tests/02.sh
+3
-3
03.sh
eth/test/tests/03.sh
+2
-2
common.sh
eth/test/tests/common.sh
+3
-3
No files found.
core/chain_manager.go
View file @
b136b387
...
@@ -238,13 +238,11 @@ func (self *ChainManager) GetBlockHashesFromHash(hash []byte, max uint64) (chain
...
@@ -238,13 +238,11 @@ func (self *ChainManager) GetBlockHashesFromHash(hash []byte, max uint64) (chain
// XXX Could be optimised by using a different database which only holds hashes (i.e., linked list)
// XXX Could be optimised by using a different database which only holds hashes (i.e., linked list)
for
i
:=
uint64
(
0
);
i
<
max
;
i
++
{
for
i
:=
uint64
(
0
);
i
<
max
;
i
++
{
block
=
self
.
GetBlock
(
block
.
Header
()
.
ParentHash
)
chain
=
append
(
chain
,
block
.
Hash
())
chain
=
append
(
chain
,
block
.
Hash
())
if
block
.
Header
()
.
Number
.
Cmp
(
ethutil
.
Big0
)
<=
0
{
if
block
.
Header
()
.
Number
.
Cmp
(
ethutil
.
Big0
)
<=
0
{
break
break
}
}
block
=
self
.
GetBlock
(
block
.
Header
()
.
ParentHash
)
}
}
return
return
...
...
eth/block_pool.go
View file @
b136b387
This diff is collapsed.
Click to expand it.
eth/block_pool_test.go
View file @
b136b387
This diff is collapsed.
Click to expand it.
eth/error.go
View file @
b136b387
...
@@ -16,6 +16,7 @@ const (
...
@@ -16,6 +16,7 @@ const (
ErrInvalidBlock
ErrInvalidBlock
ErrInvalidPoW
ErrInvalidPoW
ErrUnrequestedBlock
ErrUnrequestedBlock
ErrInsufficientChainInfo
)
)
var
errorToString
=
map
[
int
]
string
{
var
errorToString
=
map
[
int
]
string
{
...
@@ -30,6 +31,7 @@ var errorToString = map[int]string{
...
@@ -30,6 +31,7 @@ var errorToString = map[int]string{
ErrInvalidBlock
:
"Invalid block"
,
ErrInvalidBlock
:
"Invalid block"
,
ErrInvalidPoW
:
"Invalid PoW"
,
ErrInvalidPoW
:
"Invalid PoW"
,
ErrUnrequestedBlock
:
"Unrequested block"
,
ErrUnrequestedBlock
:
"Unrequested block"
,
ErrInsufficientChainInfo
:
"Insufficient chain info"
,
}
}
type
protocolError
struct
{
type
protocolError
struct
{
...
...
eth/protocol.go
View file @
b136b387
...
@@ -211,16 +211,6 @@ func (self *ethProtocol) handle() error {
...
@@ -211,16 +211,6 @@ func (self *ethProtocol) handle() error {
// uses AddPeer followed by AddHashes, AddBlock only if peer is the best peer
// uses AddPeer followed by AddHashes, AddBlock only if peer is the best peer
// (or selected as new best peer)
// (or selected as new best peer)
if
self
.
blockPool
.
AddPeer
(
request
.
TD
,
hash
,
self
.
id
,
self
.
requestBlockHashes
,
self
.
requestBlocks
,
self
.
protoErrorDisconnect
)
{
if
self
.
blockPool
.
AddPeer
(
request
.
TD
,
hash
,
self
.
id
,
self
.
requestBlockHashes
,
self
.
requestBlocks
,
self
.
protoErrorDisconnect
)
{
called
:=
true
iter
:=
func
()
([]
byte
,
bool
)
{
if
called
{
called
=
false
return
hash
,
true
}
else
{
return
nil
,
false
}
}
self
.
blockPool
.
AddBlockHashes
(
iter
,
self
.
id
)
self
.
blockPool
.
AddBlock
(
request
.
Block
,
self
.
id
)
self
.
blockPool
.
AddBlock
(
request
.
Block
,
self
.
id
)
}
}
...
...
eth/test/tests/02.sh
View file @
b136b387
...
@@ -12,8 +12,8 @@ EOF
...
@@ -12,8 +12,8 @@ EOF
peer 11 01
peer 11 01
peer 12 02
peer 12 02
P1
3
ID
=
$PID
P1
2
ID
=
$PID
test_node
$NAME
""
-loglevel
5
$JSFILE
test_node
$NAME
""
-loglevel
5
$JSFILE
sleep
0.
5
sleep
0.
3
kill
$P1
3
ID
kill
$P1
2
ID
eth/test/tests/03.sh
View file @
b136b387
#!/bin/bash
#!/bin/bash
TIMEOUT
=
35
TIMEOUT
=
12
cat
>>
$JSFILE
<<
EOF
cat
>>
$JSFILE
<<
EOF
eth.addPeer("localhost:30311");
eth.addPeer("localhost:30311");
sleep(
3
0000);
sleep(
1
0000);
eth.export("
$CHAIN_TEST
");
eth.export("
$CHAIN_TEST
");
EOF
EOF
...
...
eth/test/tests/common.sh
View file @
b136b387
...
@@ -3,14 +3,14 @@
...
@@ -3,14 +3,14 @@
# launched by run.sh
# launched by run.sh
function
test_node
{
function
test_node
{
rm
-rf
$DIR
/
$1
rm
-rf
$DIR
/
$1
ARGS
=
"-datadir
$DIR
/
$1
-debug debug -seed=false -shh=false -id test
$1
"
ARGS
=
"-datadir
$DIR
/
$1
-debug debug -seed=false -shh=false -id test
$1
-port 303
$1
"
if
[
""
!=
"
$2
"
]
;
then
if
[
""
!=
"
$2
"
]
;
then
chain
=
"chains/
$2
.chain"
chain
=
"chains/
$2
.chain"
echo
"import chain
$chain
"
echo
"import chain
$chain
"
$ETH
$ARGS
-loglevel
3
-chain
$chain
|
grep
CLI |grep import
$ETH
$ARGS
-loglevel
3
-chain
$chain
|
grep
CLI |grep import
fi
fi
echo
"starting test node
$1
with
extra args
${
@
:3
}
"
echo
"starting test node
$1
with
args
$ARGS
${
@
:3
}
"
$ETH
$ARGS
-port
303
$1
${
@
:3
}
&
$ETH
$ARGS
${
@
:3
}
&
PID
=
$!
PID
=
$!
PIDS
=
"
$PIDS
$PID
"
PIDS
=
"
$PIDS
$PID
"
}
}
...
...
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