Skip to content

Commit

Permalink
peer.go: updated copy for td
Browse files Browse the repository at this point in the history
  • Loading branch information
alanorwick committed Jun 30, 2022
1 parent 3800588 commit 0f1692d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions eth/protocols/eth/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ func (p *Peer) Head() (hash common.Hash, td []*big.Int) {
defer p.lock.RUnlock()

copy(hash[:], p.head[:])
newTd := new([]*big.Int)
copy(*newTd, p.td)
return hash, *newTd
newTd := make([]*big.Int, 0)
newTd = append(newTd, td...)
return hash, newTd
}

// SetHead updates the head hash and total difficulty of the peer.
Expand Down

0 comments on commit 0f1692d

Please sign in to comment.