mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-12 04:30:04 +00:00
Remove unused p2p encoding method (#6411)
* Remove unused p2p encoding method
This commit is contained in:
parent
1b430e0c17
commit
806a465117
@ -12,8 +12,6 @@ const (
|
|||||||
|
|
||||||
// NetworkEncoding represents an encoder compatible with Ethereum 2.0 p2p.
|
// NetworkEncoding represents an encoder compatible with Ethereum 2.0 p2p.
|
||||||
type NetworkEncoding interface {
|
type NetworkEncoding interface {
|
||||||
// Decode to the provided message. The interface must be a pointer to the decoding destination.
|
|
||||||
Decode([]byte, interface{}) error
|
|
||||||
// DecodeGossip to the provided gossip message. The interface must be a pointer to the decoding destination.
|
// DecodeGossip to the provided gossip message. The interface must be a pointer to the decoding destination.
|
||||||
DecodeGossip([]byte, interface{}) error
|
DecodeGossip([]byte, interface{}) error
|
||||||
// DecodeWithLength a bytes from a reader with a varint length prefix. The interface must be a pointer to the
|
// DecodeWithLength a bytes from a reader with a varint length prefix. The interface must be a pointer to the
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package encoder
|
package encoder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
@ -113,23 +112,6 @@ func (e SszNetworkEncoder) doDecode(b []byte, to interface{}) error {
|
|||||||
return ssz.Unmarshal(b, to)
|
return ssz.Unmarshal(b, to)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode the bytes to the protobuf message provided.
|
|
||||||
func (e SszNetworkEncoder) Decode(b []byte, to interface{}) error {
|
|
||||||
if e.UseSnappyCompression {
|
|
||||||
newBuffer := bytes.NewBuffer(b)
|
|
||||||
r := newBufferedReader(newBuffer)
|
|
||||||
defer bufReaderPool.Put(r)
|
|
||||||
|
|
||||||
newObj := make([]byte, len(b))
|
|
||||||
numOfBytes, err := r.Read(newObj)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return e.doDecode(newObj[:numOfBytes], to)
|
|
||||||
}
|
|
||||||
return e.doDecode(b, to)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DecodeGossip decodes the bytes to the protobuf gossip message provided.
|
// DecodeGossip decodes the bytes to the protobuf gossip message provided.
|
||||||
func (e SszNetworkEncoder) DecodeGossip(b []byte, to interface{}) error {
|
func (e SszNetworkEncoder) DecodeGossip(b []byte, to interface{}) error {
|
||||||
if e.UseSnappyCompression {
|
if e.UseSnappyCompression {
|
||||||
|
Loading…
Reference in New Issue
Block a user