MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / validateBlock

Function validateBlock

consensus/reactor_test.go:668–682  ·  view source on GitHub ↗

expects high synchrony!

(block *types.Block, activeVals map[string]struct{})

Source from the content-addressed store, hash-verified

666
667// expects high synchrony!
668func validateBlock(block *types.Block, activeVals map[string]struct{}) error {
669 if block.LastCommit.Size() != len(activeVals) {
670 return fmt.Errorf(
671 "commit size doesn't match number of active validators. Got %d, expected %d",
672 block.LastCommit.Size(),
673 len(activeVals))
674 }
675
676 for _, commitSig := range block.LastCommit.Signatures {
677 if _, ok := activeVals[string(commitSig.ValidatorAddress)]; !ok {
678 return fmt.Errorf("found vote for inactive validator %X", commitSig.ValidatorAddress)
679 }
680 }
681 return nil
682}
683
684func timeoutWaitGroup(t *testing.T, n int, f func(int), css []*State) {
685 wg := new(sync.WaitGroup)

Calls 1

SizeMethod · 0.65

Tested by

no test coverage detected