Merge pull request #3708 from filecoin-project/feat/warn-random-selection
warn when optimal selection fails to pack a block and we fall back to random selection
This commit is contained in:
commit
f983145897
@ -309,8 +309,10 @@ tailLoop:
|
|||||||
|
|
||||||
// if we have gasLimit to spare, pick some random (non-negative) chains to fill the block
|
// if we have gasLimit to spare, pick some random (non-negative) chains to fill the block
|
||||||
// we pick randomly so that we minimize the probability of duplication among all miners
|
// we pick randomly so that we minimize the probability of duplication among all miners
|
||||||
startRandom := time.Now()
|
|
||||||
if gasLimit >= minGas {
|
if gasLimit >= minGas {
|
||||||
|
randomCount := 0
|
||||||
|
|
||||||
|
startRandom := time.Now()
|
||||||
shuffleChains(chains)
|
shuffleChains(chains)
|
||||||
|
|
||||||
for _, chain := range chains {
|
for _, chain := range chains {
|
||||||
@ -359,15 +361,23 @@ tailLoop:
|
|||||||
curChain := chainDeps[i]
|
curChain := chainDeps[i]
|
||||||
curChain.merged = true
|
curChain.merged = true
|
||||||
result = append(result, curChain.msgs...)
|
result = append(result, curChain.msgs...)
|
||||||
|
randomCount += len(curChain.msgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
chain.merged = true
|
chain.merged = true
|
||||||
result = append(result, chain.msgs...)
|
result = append(result, chain.msgs...)
|
||||||
|
randomCount += len(chain.msgs)
|
||||||
gasLimit -= chainGasLimit
|
gasLimit -= chainGasLimit
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if dt := time.Since(startRandom); dt > time.Millisecond {
|
if dt := time.Since(startRandom); dt > time.Millisecond {
|
||||||
log.Infow("pack random tail chains done", "took", dt)
|
log.Infow("pack random tail chains done", "took", dt)
|
||||||
|
}
|
||||||
|
|
||||||
|
if randomCount > 0 {
|
||||||
|
log.Warnf("optimal selection failed to pack a block; picked %d messages with random selection",
|
||||||
|
randomCount)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user