Skip to content

Commit

Permalink
Fix the crash related to the hard-fork change in the peer
Browse files Browse the repository at this point in the history
  • Loading branch information
gameofpointers authored and jdowning100 committed Jan 3, 2024
1 parent 67294d1 commit 72c8b79
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion eth/protocols/eth/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const c_ProtocolName = "quai"

// ProtocolVersions are the supported versions of the `eth` protocol (first
// is primary).
var ProtocolVersions = []uint{QUAI1, QUAI2}
var ProtocolVersions = []uint{QUAI2}

// protocolLengths are the number of implemented message corresponding to
// different protocol versions.
Expand Down
6 changes: 6 additions & 0 deletions p2p/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,9 @@ outer:
func (p *Peer) startProtocols(writeStart <-chan struct{}, writeErr chan<- error) {
p.wg.Add(len(p.running))
for _, proto := range p.running {
if proto == nil {
continue
}
proto := proto
proto.closed = p.closed
proto.wstart = writeStart
Expand All @@ -408,6 +411,9 @@ func (p *Peer) startProtocols(writeStart <-chan struct{}, writeErr chan<- error)
p.log.Trace(fmt.Sprintf("Starting protocol %s/%d", proto.Name, proto.Version))
go func() {
defer p.wg.Done()
if proto == nil {
return
}
err := proto.Run(p, rw)
if err == nil {
p.log.Trace(fmt.Sprintf("Protocol %s/%d returned", proto.Name, proto.Version))
Expand Down

0 comments on commit 72c8b79

Please sign in to comment.