aboutsummaryrefslogtreecommitdiffstats
path: root/eth/protocol.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-09-01 01:21:02 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-09-11 22:42:25 +0800
commit2b339cbbd8bb475d2195d54a71dcced700003430 (patch)
tree7520c67d5bb5c66fe2430394a72f83d052bbe2b7 /eth/protocol.go
parent4e075e401354b4ee068cf78b1f283763fe927245 (diff)
downloadgo-tangerine-2b339cbbd8bb475d2195d54a71dcced700003430.tar.gz
go-tangerine-2b339cbbd8bb475d2195d54a71dcced700003430.tar.zst
go-tangerine-2b339cbbd8bb475d2195d54a71dcced700003430.zip
core, eth: split the db blocks into headers and bodies
Diffstat (limited to 'eth/protocol.go')
-rw-r--r--eth/protocol.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/eth/protocol.go b/eth/protocol.go
index 49f096a3b..24007bbb5 100644
--- a/eth/protocol.go
+++ b/eth/protocol.go
@@ -213,6 +213,22 @@ type blockBody struct {
// blockBodiesData is the network packet for block content distribution.
type blockBodiesData []*blockBody
+// blockBodyRLP represents the RLP encoded data content of a single block.
+type blockBodyRLP []byte
+
+// EncodeRLP is a specialized encoder for a block body to pass the already
+// encoded body RLPs from the database on, without double encoding.
+func (b *blockBodyRLP) EncodeRLP(w io.Writer) error {
+ if _, err := w.Write([]byte(*b)); err != nil {
+ return err
+ }
+ return nil
+}
+
+// blockBodiesRLPData is the network packet for block content distribution
+// based on original RLP formatting (i.e. skip the db-decode/proto-encode).
+type blockBodiesRLPData []*blockBodyRLP
+
// nodeDataData is the network response packet for a node data retrieval.
type nodeDataData []struct {
Value []byte