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

Method handleBootstrap

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

Source from the content-addressed store, hash-verified

482}
483
484func (d *DosNode) handleBootstrap(currentBlockNumber uint64) {
485 cid, err := d.chain.BootstrapRound()
486 if err != nil {
487 d.logger.Error(err)
488 return
489 }
490 if cid == 0 {
491 d.logger.Debug("[DOS] Not in bootstrap phase ...")
492 return
493 }
494 bootstrapEndBlk, err := d.chain.BootstrapEndBlk()
495 if err != nil {
496 d.logger.Error(err)
497 return
498 }
499 if currentBlockNumber <= bootstrapEndBlk {
500 d.logger.Debug("[DOS] Waiting for bootstrap to end before next step ...")
501 return
502 }
503 pendingNodeSize, err := d.chain.NumPendingNodes()
504 if err != nil {
505 d.logger.Error(err)
506 return
507 }
508 bootstrapThreshold, err := d.chain.BootstrapStartThreshold()
509 if err != nil {
510 d.logger.Error(err)
511 return
512 }
513 if pendingNodeSize < bootstrapThreshold {
514 d.logger.Debug(
515 fmt.Sprintf(
516 "[DOS] Not enough registered pendingNodes (%v) vs minimum bootstrap threshold (%v), skipping bootstrap ...",
517 pendingNodeSize, bootstrapThreshold))
518 return
519 }
520
521 d.logger.Debug("[DOS] Signaling system to bootstrap ...")
522 if err := d.chain.SignalBootstrap(big.NewInt(int64(cid))); err != nil {
523 d.logger.Error(err)
524 }
525}
526
527func (d *DosNode) handleGroupDissolve() {
528 pendingGroupSize, err := d.chain.NumPendingGroups()

Callers 1

onchainLoopMethod · 0.95

Calls 7

BootstrapRoundMethod · 0.65
ErrorMethod · 0.65
DebugMethod · 0.65
BootstrapEndBlkMethod · 0.65
NumPendingNodesMethod · 0.65
SignalBootstrapMethod · 0.65

Tested by

no test coverage detected