p2p: fix peer list encoding

It sent [0x5, [p1, p2, ...]] but needs to send [0x5, p1, p2, ...]
This commit is contained in:
Felix Lange 2015-01-03 14:16:48 +01:00
parent 19d9cc33e4
commit 2111cb9d7b

View file

@ -3,8 +3,6 @@ package p2p
import (
"bytes"
"time"
"github.com/ethereum/go-ethereum/ethutil"
)
// Protocol represents a P2P subprotocol implementation.
@ -180,7 +178,7 @@ func (bp *baseProtocol) handle(rw MsgReadWriter) error {
//
// TODO: add event mechanism to notify baseProtocol for new peers
if len(peers) > 0 {
return bp.rw.EncodeMsg(peersMsg, peers)
return bp.rw.EncodeMsg(peersMsg, peers...)
}
case peersMsg:
@ -272,9 +270,9 @@ func (bp *baseProtocol) handshakeMsg() Msg {
)
}
func (bp *baseProtocol) peerList() []ethutil.RlpEncodable {
func (bp *baseProtocol) peerList() []interface{} {
peers := bp.peer.otherPeers()
ds := make([]ethutil.RlpEncodable, 0, len(peers))
ds := make([]interface{}, 0, len(peers))
for _, p := range peers {
p.infolock.Lock()
addr := p.listenAddr