Skip to content

Commit

Permalink
identity: simplify PublicKey interface
Browse files Browse the repository at this point in the history
dbft package itself doesn't need anything from PublicKey. It's the user
who is responsible for public keys comparison and WithGetKeyPair
callback implementation.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
  • Loading branch information
AnnaShaleva committed Apr 24, 2024
1 parent c66739b commit 4614749
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import (

type (
// PublicKey is a generic public key interface used by dbft.
PublicKey interface {
// Equals returns whether public key is equal to the other.
Equals(other PublicKey) bool
}
PublicKey any

// PrivateKey is a generic private key interface used by dbft.
PrivateKey interface {
Expand Down
2 changes: 1 addition & 1 deletion internal/consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func New(logger *zap.Logger, key dbft.PrivateKey, pub dbft.PublicKey,
dbft.WithSecondsPerBlock[crypto.Uint256](time.Second*5),
dbft.WithGetKeyPair[crypto.Uint256](func(pubs []dbft.PublicKey) (int, dbft.PrivateKey, dbft.PublicKey) {
for i := range pubs {
if pub.Equals(pubs[i]) {
if pub.(*crypto.ECDSAPub).Equals(pubs[i]) {
return i, key, pub
}
}
Expand Down

0 comments on commit 4614749

Please sign in to comment.