Skip to content

Commit

Permalink
increased block announcement queue to reduce the chance of losing them
Browse files Browse the repository at this point in the history
  • Loading branch information
sadoci committed Sep 23, 2019
1 parent 1a2af5b commit fff6df2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions eth/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ const (
// maxQueuedProps is the maximum number of block propagations to queue up before
// dropping broadcasts. There's not much point in queueing stale blocks, so a few
// that might cover uncles should be enough.
maxQueuedProps = 4
maxQueuedProps = 1024

// maxQueuedAnns is the maximum number of block announcements to queue up before
// dropping broadcasts. Similarly to block propagations, there's no point to queue
// above some healthy uncle limit, so use that.
maxQueuedAnns = 4
maxQueuedAnns = 1024

handshakeTimeout = 5 * time.Second
)
Expand Down Expand Up @@ -134,11 +134,6 @@ func (p *peer) broadcast() {

for {
select {
case txs := <-p.queuedTxs:
for _, i := range txs {
b.Put(i)
}

case prop := <-p.queuedProps:
if err := p.SendNewBlock(prop.block, prop.td); err != nil {
return
Expand All @@ -151,6 +146,11 @@ func (p *peer) broadcast() {
}
p.Log().Trace("Announced block", "number", block.Number(), "hash", block.Hash())

case txs := <-p.queuedTxs:
for _, i := range txs {
b.Put(i)
}

case <-p.term:
return
}
Expand Down

0 comments on commit fff6df2

Please sign in to comment.