(currentBlockNumber uint64)
| 482 | } |
| 483 | |
| 484 | func (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 | |
| 527 | func (d *DosNode) handleGroupDissolve() { |
| 528 | pendingGroupSize, err := d.chain.NumPendingGroups() |
no test coverage detected