aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/peer.go
diff options
context:
space:
mode:
Diffstat (limited to 'eth/downloader/peer.go')
-rw-r--r--eth/downloader/peer.go32
1 files changed, 28 insertions, 4 deletions
diff --git a/eth/downloader/peer.go b/eth/downloader/peer.go
index 71a692688..96870da50 100644
--- a/eth/downloader/peer.go
+++ b/eth/downloader/peer.go
@@ -75,19 +75,43 @@ type peerConnection struct {
lock sync.RWMutex
}
-type Peer interface {
+type LightPeer interface {
Head() (common.Hash, *big.Int)
RequestHeadersByHash(common.Hash, int, int, bool) error
RequestHeadersByNumber(uint64, int, int, bool) error
+}
+
+type Peer interface {
+ LightPeer
RequestBodies([]common.Hash) error
RequestReceipts([]common.Hash) error
RequestNodeData([]common.Hash) error
}
-// newPeer create a new downloader peer, with specific hash and block retrieval
-// mechanisms.
-func newPeerConnection(id string, version int, peer Peer, logger log.Logger) *peerConnection {
+// lightPeerWrapper wraps a LightPeer struct, stubbing out the Peer-only methods.
+type lightPeerWrapper struct {
+ peer LightPeer
+}
+func (w *lightPeerWrapper) Head() (common.Hash, *big.Int) { return w.peer.Head() }
+func (w *lightPeerWrapper) RequestHeadersByHash(h common.Hash, amount int, skip int, reverse bool) error {
+ return w.peer.RequestHeadersByHash(h, amount, skip, reverse)
+}
+func (w *lightPeerWrapper) RequestHeadersByNumber(i uint64, amount int, skip int, reverse bool) error {
+ return w.peer.RequestHeadersByNumber(i, amount, skip, reverse)
+}
+func (w *lightPeerWrapper) RequestBodies([]common.Hash) error {
+ panic("RequestBodies not supported in light client mode sync")
+}
+func (w *lightPeerWrapper) RequestReceipts([]common.Hash) error {
+ panic("RequestReceipts not supported in light client mode sync")
+}
+func (w *lightPeerWrapper) RequestNodeData([]common.Hash) error {
+ panic("RequestNodeData not supported in light client mode sync")
+}
+
+// newPeerConnection creates a new downloader peer
+func newPeerConnection(id string, version int, peer Peer, logger log.Logger) *peerConnection {
return &peerConnection{
id: id,
lacking: make(map[common.Hash]struct{}),
class='insertions'>+2 * games/wesnoth: add pkg-message for charset informationtz2017-05-161-0/+5 * devel/boost-*: update to 1.64.0jbeich2017-05-021-1/+1 * Bump PORTREVISIONs for ports depending on the canonical version of GCC andgerald2017-04-011-1/+1 * devel/boost-*: update to 1.63.0jbeich2017-01-061-0/+1 * games/wesnoth: Update from 1.12.5 to 1.12.6tz2016-12-212-4/+4 * games/wesnoth: Enable OPENMP by defaulttz2016-12-191-4/+3 * devel/boost-*: update to 1.62.0jbeich2016-11-231-1/+1 * Bump PORTREVISIONS for ports depending on the canonical version of GCC andgerald2016-11-201-0/+1 * Change MAINTAINER from ports@toco-domains.de to tz@FreeBSD.orgtz2016-06-101-1/+1 * Remove ${PORTSDIR}/ from dependencies, categories d, e, f, and g.mat2016-04-011-6/+6 * games/wesnoth: update 1.12.4 -> 1.12.5junovitch2015-11-172-4/+4 * - Fix build with TEST enabledamdmi32015-11-063-2/+11 * games/wesnoth: add portscout informationrobak2015-09-251-1/+3 * games/wesnoth: convert to BROKEN helperjbeich2015-08-281-10/+2 * - Fix shebangsamdmi32015-07-291-1/+6 * Update to 1.12.4.delphij2015-07-012-3/+3 * games/wesnoth: Revert version 1.13 => 1.12marino2015-05-263-11/+12 * - Update to 1.13.0amdmi32015-05-163-11/+11 * - Add CPE informationjbeich2015-04-171-1/+4 * - Update to 1.12.2jbeich2015-04-172-3/+3 * - Update to 1.12.1 [1]jbeich2015-02-173-174/+82 * games/wesnoth: Upgrade version 1.10.7 => 1.12.0, change maintainersmarino2015-02-0613-437/+201 * Bump portrevision after png updatebapt2014-12-261-1/+1 * Change libpng15.so to libpng.so in LIB_DEPENDS to prepare the upgradeantoine2014-12-261-1/+1 * Replace USES=libtool:oldver with USES=libtool or USES=libtool:keepla intijl2014-12-091-1/+1 * - Convert games/ to new USES=pythonmva2014-10-211-1/+1 * . Fix USES clauses:glewis2014-09-141-3/+2 * Update the default version of GCC in the Ports Collection from GCC 4.7.4gerald2014-09-111-1/+1 * converters/fribidi:tijl2014-08-311-1/+1 * Fix non default LIB_DEPENDSbapt2014-07-161-2/+2 * Add DOCS to OPTIONS_DEFINE to ports that check for PORT_OPTIONS:MDOCS.adamw2014-07-151-1/+1 * - Convert net/sdl_net to USES=libtool and bump dependent portstijl2014-07-101-1/+1 * - Stage supportmiwi2014-06-062-3/+57 * Chase boost and icu bumpbapt2014-02-071-0/+1 * Convert LIB_DEPENDS for ports depending on boostbapt2013-12-121-2/+2 * - Fix build with clang [1]ak2013-11-243-0/+30 * . Update to 1.10.7glewis2013-10-282-3/+3 * - Remove manual creation and removal of share/applications, as it's now in th...amdmi32013-10-221-1/+0 * Add NO_STAGE all over the place in preparation for the staging support (cat: ...bapt2013-09-211-0/+1 * Add explicit dependency on pkgconf (6 ports)marino2013-09-111-1/+1 * - Remove MAKE_JOBS_SAFE variableak2013-08-151-1/+0 * - Convert USE_GETTEXT to USES (part 4)ak2013-04-261-1/+1 * - Update to 1.10.6bdrewery2013-04-172-5/+4 * - convert USE_CMAKE to USESmakc2013-03-231-1/+1 * Chase boost updatebapt2013-01-311-0/+1 * Remove the created by me and update those header at the same time. I nevermezz2013-01-011-5/+0 * - Fix unneeded escape (1)amdmi32012-12-103-4/+34 * - Update to 1.10.4culot2012-09-282-4/+3 * - Fix NLS support [1]ak2012-07-112-70/+85 * Re-assign maintainership to ports@. I regret that I have not been able tophilip2012-07-091-1/+1 * - Fix build on pointyhatak2012-06-181-6/+4 * - Update to 1.10.3 (see http://changelog.wesnoth.org for details)ak2012-06-1015-223/+460 * - update png to 1.5.10dinoex2012-06-012-3/+14 * - Update devel/sdl12 to 1.2.15mva2012-02-181-0/+1 * - Get rid FreeBSD 6 supportmiwi2011-11-07