func (tm2pb) PubKey(pubKey crypto.PubKey) abci.PubKey {
	switch pk := pubKey.(type) {
	case ed25519.PubKeyEd25519:
		return abci.PubKey{
			Type: ABCIPubKeyTypeEd25519,
			Data: pk[:],
		}
	case secp256k1.PubKeySecp256k1:
		return abci.PubKey{
			Type: ABCIPubKeyTypeSecp256k1,
			Data: pk[:],
		}
	case bls.PubKeyBls:
		marshaled := pk.Bytes()
		return abci.PubKey{
			Type: ABCIPubKeyTypeBLS,
			Data: marshaled,
		}
	default:
		panic(fmt.Sprintf("unknown pubkey type: %v %v", pubKey, reflect.TypeOf(pubKey)))
	}
}
// XXX: panics on nil or unknown pubkey type
// TODO: add cases when new pubkey types are added to crypto
panics on nil or unknown pubkey type
TODO: add cases when new pubkey types are added to crypto
// XXX : panics on nil or unknown pubkey type // TODO : add cases when new pubkey types are added to crypto
func (tm2pb) PubKey(pubKey crypto.PubKey) abci.PubKey {
	switch pk := pubKey.(type) {
	case ed25519.PubKeyEd25519:
		return abci.PubKey{
			Type: ABCIPubKeyTypeEd25519,
			Data: pk[:],
		}
	case secp256k1.PubKeySecp256k1:
		return abci.PubKey{
			Type: ABCIPubKeyTypeSecp256k1,
			Data: pk[:],
		}
	case bls.PubKeyBls:
		marshaled := pk.Bytes()
		return abci.PubKey{
			Type: ABCIPubKeyTypeBLS,
			Data: marshaled,
		}
	default:
		panic(fmt.Sprintf("unknown pubkey type: %v %v", pubKey, reflect.TypeOf(pubKey)))
	}
}
func ( tm2pb ) PubKey ( pubKey crypto . PubKey ) abci . PubKey { switch pk := pubKey . ( type ) { case ed25519 . PubKeyEd25519 : return abci . PubKey { Type : ABCIPubKeyTypeEd25519 , Data : pk [ : ] , } case secp256k1 . PubKeySecp256k1 : return abci . PubKey { Type : ABCIPubKeyTypeSecp256k1 , Data : pk [ : ] , } case bls . PubKeyBls : marshaled := pk . Bytes ( ) return abci . PubKey { Type : ABCIPubKeyTypeBLS , Data : marshaled , } default : panic ( fmt . Sprintf ( " " , pubKey , reflect . TypeOf ( pubKey ) ) ) } }
panics on nil or unknown pubkey type
TODO: add cases when new pubkey types are added to crypto
panics on nil or unknown pubkey type TODO : add cases when new pubkey types are added to crypto