aboutsummaryrefslogtreecommitdiffstats
path: root/eth/peer.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-07-03 00:55:18 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-08-24 22:57:28 +0800
commit42f44dda5468000b3b2c005ec485529bc5da3674 (patch)
treec93c9a2734adceac75e48f825076d48325826140 /eth/peer.go
parentc51e153b5c5327f971e7b410e49e7babfc3f0b8e (diff)
downloadgo-tangerine-42f44dda5468000b3b2c005ec485529bc5da3674.tar.gz
go-tangerine-42f44dda5468000b3b2c005ec485529bc5da3674.tar.zst
go-tangerine-42f44dda5468000b3b2c005ec485529bc5da3674.zip
eth, eth/downloader: handle header requests, table driven proto tests
Diffstat (limited to 'eth/peer.go')
-rw-r--r--eth/peer.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/eth/peer.go b/eth/peer.go
index c17cdfca7..78de8a9d3 100644
--- a/eth/peer.go
+++ b/eth/peer.go
@@ -165,12 +165,23 @@ func (p *peer) SendBlockHeaders(headers []*types.Header) error {
return p2p.Send(p.rw, BlockHeadersMsg, headers)
}
+// SendBlockBodies sends a batch of block contents to the remote peer.
+func (p *peer) SendBlockBodies(bodies []*blockBody) error {
+ return p2p.Send(p.rw, BlockBodiesMsg, blockBodiesData(bodies))
+}
+
// SendNodeData sends a batch of arbitrary internal data, corresponding to the
// hashes requested.
func (p *peer) SendNodeData(data [][]byte) error {
return p2p.Send(p.rw, NodeDataMsg, data)
}
+// SendReceipts sends a batch of transaction receipts, corresponding to the ones
+// requested.
+func (p *peer) SendReceipts(receipts []*types.Receipt) error {
+ return p2p.Send(p.rw, ReceiptsMsg, receipts)
+}
+
// RequestHashes fetches a batch of hashes from a peer, starting at from, going
// towards the genesis block.
func (p *peer) RequestHashes(from common.Hash) error {
@@ -205,6 +216,12 @@ func (p *peer) RequestNodeData(hashes []common.Hash) error {
return p2p.Send(p.rw, GetNodeDataMsg, hashes)
}
+// RequestReceipts fetches a batch of transaction receipts from a remote node.
+func (p *peer) RequestReceipts(hashes []common.Hash) error {
+ glog.V(logger.Debug).Infof("%v fetching %v receipts\n", p, len(hashes))
+ return p2p.Send(p.rw, GetReceiptsMsg, hashes)
+}
+
// Handshake executes the eth protocol handshake, negotiating version number,
// network IDs, difficulties, head and genesis blocks.
func (p *peer) Handshake(td *big.Int, head common.Hash, genesis common.Hash) error {