mirror of https://github.com/poanetwork/gecko.git
Issue multiple polls at vertex/block issuance if below ConcurrentRepoll threshold
This commit is contained in:
parent
6bde51cb7c
commit
c49b0c0ff6
|
@ -27,8 +27,10 @@ func (p Parameters) Valid() error {
|
|||
return fmt.Errorf("BetaVirtuous = %d: Fails the condition that: 0 < BetaVirtuous", p.BetaVirtuous)
|
||||
case p.BetaRogue < p.BetaVirtuous:
|
||||
return fmt.Errorf("BetaVirtuous = %d, BetaRogue = %d: Fails the condition that: BetaVirtuous <= BetaRogue", p.BetaVirtuous, p.BetaRogue)
|
||||
case p.ConcurrentRepolls <= 0 || p.ConcurrentRepolls > p.BetaRogue:
|
||||
return fmt.Errorf("ConcurrentRepolls = %d, BetaRogue = %d: Fails the condition that: 0 < ConcurrentRepolls <= BetaRogue", p.ConcurrentRepolls, p.BetaRogue)
|
||||
case p.ConcurrentRepolls <= 0:
|
||||
return fmt.Errorf("ConcurrentRepolls = %d: Fails the condition that: 0 < ConcurrentRepolls", p.ConcurrentRepolls)
|
||||
case p.ConcurrentRepolls > p.BetaRogue:
|
||||
return fmt.Errorf("ConcurrentRepolls = %d, BetaRogue = %d: Fails the condition that: ConcurrentRepolls <= BetaRogue", p.ConcurrentRepolls, p.BetaRogue)
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -65,8 +65,10 @@ func (i *issuer) Update() {
|
|||
}
|
||||
|
||||
i.t.RequestID++
|
||||
polled := false
|
||||
if numVdrs := len(vdrs); numVdrs == p.K && i.t.polls.Add(i.t.RequestID, vdrSet.Len()) {
|
||||
i.t.Config.Sender.PushQuery(vdrSet, i.t.RequestID, vtxID, i.vtx.Bytes())
|
||||
polled = true
|
||||
} else if numVdrs < p.K {
|
||||
i.t.Config.Context.Log.Error("Query for %s was dropped due to an insufficient number of validators", vtxID)
|
||||
}
|
||||
|
@ -75,6 +77,10 @@ func (i *issuer) Update() {
|
|||
for _, tx := range i.vtx.Txs() {
|
||||
i.t.txBlocked.Fulfill(tx.ID())
|
||||
}
|
||||
|
||||
if polled && len(i.t.polls.m) < i.t.Params.ConcurrentRepolls {
|
||||
i.t.repoll()
|
||||
}
|
||||
}
|
||||
|
||||
type vtxIssuer struct{ i *issuer }
|
||||
|
|
|
@ -305,7 +305,7 @@ func (t *Transitive) pullSample(blkID ids.ID) {
|
|||
}
|
||||
}
|
||||
|
||||
func (t *Transitive) pushSample(blk snowman.Block) {
|
||||
func (t *Transitive) pushSample(blk snowman.Block) bool {
|
||||
t.Config.Context.Log.Verbo("About to sample from: %s", t.Config.Validators)
|
||||
p := t.Consensus.Parameters()
|
||||
vdrs := t.Config.Validators.Sample(p.K)
|
||||
|
@ -315,11 +315,14 @@ func (t *Transitive) pushSample(blk snowman.Block) {
|
|||
}
|
||||
|
||||
t.RequestID++
|
||||
queryIssued := false
|
||||
if numVdrs := len(vdrs); numVdrs == p.K && t.polls.Add(t.RequestID, vdrSet.Len()) {
|
||||
t.Config.Sender.PushQuery(vdrSet, t.RequestID, blk.ID(), blk.Bytes())
|
||||
queryIssued = true
|
||||
} else if numVdrs < p.K {
|
||||
t.Config.Context.Log.Error("Query for %s was dropped due to an insufficient number of validators", blk.ID())
|
||||
}
|
||||
return queryIssued
|
||||
}
|
||||
|
||||
func (t *Transitive) deliver(blk snowman.Block) {
|
||||
|
@ -338,9 +341,8 @@ func (t *Transitive) deliver(blk snowman.Block) {
|
|||
}
|
||||
|
||||
t.Config.Context.Log.Verbo("Adding block to consensus: %s", blkID)
|
||||
|
||||
t.Consensus.Add(blk)
|
||||
t.pushSample(blk)
|
||||
polled := t.pushSample(blk)
|
||||
|
||||
added := []snowman.Block{}
|
||||
dropped := []snowman.Block{}
|
||||
|
@ -373,6 +375,10 @@ func (t *Transitive) deliver(blk snowman.Block) {
|
|||
t.blocked.Abandon(blkID)
|
||||
}
|
||||
|
||||
if polled && len(t.polls.m) < t.Params.ConcurrentRepolls {
|
||||
t.repoll()
|
||||
}
|
||||
|
||||
// Tracks performance statistics
|
||||
t.numBlkRequests.Set(float64(t.blkReqs.Len()))
|
||||
t.numBlockedBlk.Set(float64(t.pending.Len()))
|
||||
|
|
Loading…
Reference in New Issue