GetBlockGenerationInfo returns current committee and it's Info
()
| 547 | |
| 548 | // GetBlockGenerationInfo returns current committee and it's Info |
| 549 | func (s *PublicBlockChainAPI) GetBlockGenerationInfo() cpclient.BlockGenerationInfo { |
| 550 | |
| 551 | t := s.b.CurrentTerm() |
| 552 | pi := s.b.CurrentProposerIndex() |
| 553 | v := s.b.CurrentView() |
| 554 | b := s.b.CurrentBlock() |
| 555 | cm := len(s.b.CommitteMember()) |
| 556 | proposers, err := s.b.Proposers(rpc.BlockNumber(b.Number().Uint64())) |
| 557 | if err != nil { |
| 558 | log.Fatal("get proposer error") |
| 559 | } |
| 560 | |
| 561 | header, err := s.b.HeaderByNumber(context.Background(), rpc.LatestBlockNumber) |
| 562 | blockGenerationInfo := cpclient.BlockGenerationInfo{ |
| 563 | ProposerIndex: pi, |
| 564 | Term: t, |
| 565 | View: v, |
| 566 | Proposer: header.Coinbase, |
| 567 | BlockNumber: header.Number.Uint64(), |
| 568 | TermLen: cm, |
| 569 | Proposers: proposers, |
| 570 | } |
| 571 | |
| 572 | return blockGenerationInfo |
| 573 | |
| 574 | } |
| 575 | |
| 576 | func (s *PublicBlockChainAPI) GetBlockReward(blockNr rpc.BlockNumber) uint64 { |
| 577 | return s.b.BlockReward(blockNr).Uint64() |
nothing calls this directly
no test coverage detected