mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 12:46:44 +00:00
p2p: fix peer list encoding
It sent [0x5, [p1, p2, ...]] but needs to send [0x5, p1, p2, ...]
This commit is contained in:
parent
19d9cc33e4
commit
2111cb9d7b
1 changed files with 3 additions and 5 deletions
|
|
@ -3,8 +3,6 @@ package p2p
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Protocol represents a P2P subprotocol implementation.
|
// 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
|
// TODO: add event mechanism to notify baseProtocol for new peers
|
||||||
if len(peers) > 0 {
|
if len(peers) > 0 {
|
||||||
return bp.rw.EncodeMsg(peersMsg, peers)
|
return bp.rw.EncodeMsg(peersMsg, peers...)
|
||||||
}
|
}
|
||||||
|
|
||||||
case peersMsg:
|
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()
|
peers := bp.peer.otherPeers()
|
||||||
ds := make([]ethutil.RlpEncodable, 0, len(peers))
|
ds := make([]interface{}, 0, len(peers))
|
||||||
for _, p := range peers {
|
for _, p := range peers {
|
||||||
p.infolock.Lock()
|
p.infolock.Lock()
|
||||||
addr := p.listenAddr
|
addr := p.listenAddr
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue