Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
antonydenyer committed May 20, 2022
1 parent e91d879 commit 84f44f5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions eth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package eth
import (
"errors"
"fmt"
"github.com/ethereum/go-ethereum/p2p/enr"
"math"
"math/big"
"sync"
Expand All @@ -43,6 +42,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/p2p/enr"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/qlight"
"github.com/ethereum/go-ethereum/trie"
Expand Down Expand Up @@ -720,6 +720,7 @@ func (h *handler) makeQuorumConsensusProtocol(protoName string, version uint, le
if ethPeer != nil {
p.Log().Debug("consensus subprotocol retrieved eth peer from peerset", "ethPeer.id", p2pPeerId, "ProtoName", protoName)
// add the rw protocol for the quorum subprotocol to the eth peer.
ethPeer.AddConsensusProtoRW(rw)
peer := eth.NewPeer(version, p, rw, h.txpool)
return h.handleConsensusLoop(peer, rw, backend)
}
Expand Down Expand Up @@ -771,7 +772,6 @@ func (h *handler) handleConsensus(p *eth.Peer, protoRW p2p.MsgReadWriter, backen
return err
}


var handlers = eth.ETH_65_FULL_SYNC

p.Log().Trace("Message not handled by sub-protocol", "msg", msg.Code)
Expand Down
17 changes: 14 additions & 3 deletions eth/protocols/eth/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,14 +531,25 @@ func (p *Peer) RequestTxs(hashes []common.Hash) error {

// SendConsensus Used to send consensus subprotocol messages from an "eth" peer, e.g. "istanbul/100" subprotocol messages.
func (p *Peer) SendConsensus(msgcode uint64, data interface{}) error {
return p2p.Send(p.rw, msgcode, data)
if p.consensusRw == nil {
return nil
}
return p2p.Send(p.consensusRw, msgcode, data)
}

// SendQBFTConsensus is used to send consensus subprotocol messages from an "eth" peer without encoding the payload
func (p *Peer) SendQBFTConsensus(msgcode uint64, payload []byte) error {
return p2p.SendWithNoEncoding(p.rw, msgcode, payload)
if p.consensusRw == nil {
return nil
}
return p2p.SendWithNoEncoding(p.consensusRw, msgcode, payload)
}

func (p *Peer) AddConsensusProtoRW(rw p2p.MsgReadWriter) *Peer {
p.consensusRw = rw
return p
}

func (p *Peer) Send(msgcode uint64, data interface{}) error {
panic("implement me")
}
}
4 changes: 2 additions & 2 deletions eth/quorum_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package eth

import (
"errors"
"github.com/ethereum/go-ethereum/eth/protocols/eth"
"github.com/ethereum/go-ethereum/p2p/enode"

"github.com/ethereum/go-ethereum/eth/protocols/eth"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/enode"
)

// Quorum: quorum_protocol enables the eth service to return two different protocols, one for the eth mainnet "eth" service,
Expand Down

0 comments on commit 84f44f5

Please sign in to comment.