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
fe13949d
Commit
fe13949d
authored
7 years ago
by
Nick Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/downloader: Doc fixes
parent
be8f8409
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
downloader.go
eth/downloader/downloader.go
+3
-1
peer.go
eth/downloader/peer.go
+4
-2
No files found.
eth/downloader/downloader.go
View file @
fe13949d
...
...
@@ -153,6 +153,7 @@ type Downloader struct {
chainInsertHook
func
([]
*
fetchResult
)
// Method to call upon inserting a chain of blocks (possibly in multiple invocations)
}
// LightChain encapsulates functions required to synchronise a light chain.
type
LightChain
interface
{
// HasHeader verifies a header's presence in the local chain.
HasHeader
(
common
.
Hash
)
bool
...
...
@@ -173,6 +174,7 @@ type LightChain interface {
Rollback
([]
common
.
Hash
)
}
// BlockChain encapsulates functions required to sync a (full or fast) blockchain.
type
BlockChain
interface
{
LightChain
...
...
@@ -281,7 +283,7 @@ func (d *Downloader) RegisterPeer(id string, version int, peer Peer) error {
return
nil
}
// RegisterLightPeer injects a light client peer
// RegisterLightPeer injects a light client peer
, wrapping it so it appears as a regular peer.
func
(
d
*
Downloader
)
RegisterLightPeer
(
id
string
,
version
int
,
peer
LightPeer
)
error
{
return
d
.
RegisterPeer
(
id
,
version
,
&
lightPeerWrapper
{
peer
})
}
...
...
This diff is collapsed.
Click to expand it.
eth/downloader/peer.go
View file @
fe13949d
...
...
@@ -45,7 +45,7 @@ var (
errNotRegistered
=
errors
.
New
(
"peer is not registered"
)
)
// peer represents an active peer from which hashes and blocks are retrieved.
// peer
Connection
represents an active peer from which hashes and blocks are retrieved.
type
peerConnection
struct
{
id
string
// Unique identifier of the peer
...
...
@@ -75,12 +75,14 @@ type peerConnection struct {
lock
sync
.
RWMutex
}
// LightPeer encapsulates the methods required to synchronise with a remote light peer.
type
LightPeer
interface
{
Head
()
(
common
.
Hash
,
*
big
.
Int
)
RequestHeadersByHash
(
common
.
Hash
,
int
,
int
,
bool
)
error
RequestHeadersByNumber
(
uint64
,
int
,
int
,
bool
)
error
}
// Peer encapsulates the methods required to synchronise with a remote full peer.
type
Peer
interface
{
LightPeer
RequestBodies
([]
common
.
Hash
)
error
...
...
@@ -110,7 +112,7 @@ func (w *lightPeerWrapper) RequestNodeData([]common.Hash) error {
panic
(
"RequestNodeData not supported in light client mode sync"
)
}
// newPeerConnection creates a new downloader peer
// newPeerConnection creates a new downloader peer
.
func
newPeerConnection
(
id
string
,
version
int
,
peer
Peer
,
logger
log
.
Logger
)
*
peerConnection
{
return
&
peerConnection
{
id
:
id
,
...
...
This diff is collapsed.
Click to expand it.
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