You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
631 B

  1. package batch
  2. import (
  3. "github.com/tendermint/tendermint/crypto"
  4. "github.com/tendermint/tendermint/crypto/ed25519"
  5. "github.com/tendermint/tendermint/crypto/sr25519"
  6. )
  7. // CreateBatchVerifier checks if a key type implements the batch verifier interface.
  8. // Currently only ed25519 & sr25519 supports batch verification.
  9. func CreateBatchVerifier(pk crypto.PubKey) (crypto.BatchVerifier, bool) {
  10. switch pk.Type() {
  11. case ed25519.KeyType:
  12. return ed25519.NewBatchVerifier(), true
  13. case sr25519.KeyType:
  14. return sr25519.NewBatchVerifier(), true
  15. }
  16. // case where the key does not support batch verification
  17. return nil, false
  18. }