()
| 643 | } |
| 644 | |
| 645 | func (self *Server) updateParticipantConfig() error { |
| 646 | blkNum := self.GetCurrentBlockNo() |
| 647 | block, _ := self.blockPool.getSealedBlock(blkNum - 1) |
| 648 | if block == nil { |
| 649 | return fmt.Errorf("failed to get sealed block (%d)", blkNum-1) |
| 650 | } |
| 651 | chainconfig := self.config |
| 652 | if block.Info.NewChainConfig != nil { |
| 653 | chainconfig = block.Info.NewChainConfig |
| 654 | } |
| 655 | self.metaLock.Lock() |
| 656 | cfg, err := self.buildParticipantConfig(blkNum, block, chainconfig) |
| 657 | if err == nil { |
| 658 | self.currentParticipantConfig = cfg |
| 659 | } |
| 660 | self.metaLock.Unlock() |
| 661 | if err != nil { |
| 662 | return fmt.Errorf("failed to build participant config (%d): %s", blkNum, err) |
| 663 | } |
| 664 | // TODO: if server is not in new config, self.stop() |
| 665 | return nil |
| 666 | } |
| 667 | |
| 668 | func (self *Server) startNewRound() error { |
| 669 | blkNum := self.GetCurrentBlockNo() |
no test coverage detected