MCPcopy Create free account
hub / github.com/DOSNetwork/core / handleRandom

Method handleRandom

dosnode/dos_chain_handler.go:457–482  ·  view source on GitHub ↗
(currentBlockNumber uint64)

Source from the content-addressed store, hash-verified

455}
456
457func (d *DosNode) handleRandom(currentBlockNumber uint64) {
458 groupSize, err := d.chain.GetWorkingGroupSize()
459 if err != nil {
460 d.logger.Error(err)
461 return
462 }
463 if groupSize == 0 {
464 d.logger.Debug("[DOS] No live working group, skipping...")
465 return
466 }
467 lastUpdatedBlock, err := d.chain.LastUpdatedBlock()
468 if err != nil {
469 d.logger.Error(err)
470 return
471 }
472 sysrandInterval, err := d.chain.RefreshSystemRandomHardLimit()
473 if err != nil {
474 d.logger.Error(err)
475 return
476 }
477 diff := currentBlockNumber - lastUpdatedBlock
478 if diff > sysrandInterval {
479 d.logger.Debug("[DOS] Signaling system randomness refresh...")
480 d.chain.SignalRandom()
481 }
482}
483
484func (d *DosNode) handleBootstrap(currentBlockNumber uint64) {
485 cid, err := d.chain.BootstrapRound()

Callers 1

onchainLoopMethod · 0.95

Calls 6

GetWorkingGroupSizeMethod · 0.65
ErrorMethod · 0.65
DebugMethod · 0.65
LastUpdatedBlockMethod · 0.65
SignalRandomMethod · 0.65

Tested by

no test coverage detected