Skip to content

Commit f367ec7

Browse files
committed
feat: Remove Vote.Verify()
1 parent 73ac2c3 commit f367ec7

File tree

3 files changed

+4
-20
lines changed

3 files changed

+4
-20
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ To be released.
1414
[[#3811]]
1515
- (Libplanet) `BlockChain.DetermineBlockStateRootHash()`
1616
has been removed. [[#3811]]
17+
- (Libplanet.Types) `Vote.Verify()` has been removed. [[#3837]]
1718

1819
### Backward-incompatible API changes
1920

@@ -63,6 +64,7 @@ To be released.
6364
### CLI tools
6465

6566
[#3811]: https://github.com/planetarium/libplanet/pull/3811
67+
[#3837]: https://github.com/planetarium/libplanet/pull/3837
6668

6769

6870
Version 4.6.1

Libplanet.Net/Consensus/HeightVoteSet.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,6 @@ public void AddVote(Vote vote)
120120

121121
PublicKey validatorKey = vote.ValidatorPublicKey;
122122

123-
if (validatorKey is null)
124-
{
125-
throw new InvalidVoteException("ValidatorKey of the vote cannot be null", vote);
126-
}
127-
128123
if (!_validatorSet.ContainsPublicKey(validatorKey))
129124
{
130125
throw new InvalidVoteException(
@@ -140,10 +135,10 @@ public void AddVote(Vote vote)
140135
vote);
141136
}
142137

143-
if (!vote.Verify())
138+
if (vote.Signature.IsEmpty)
144139
{
145140
throw new InvalidVoteException(
146-
"Received vote's signature is invalid",
141+
"Received vote's signature is empty",
147142
vote);
148143
}
149144

Libplanet.Types/Consensus/Vote.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,6 @@ private Vote(Bencodex.Types.Dictionary encoded)
117117
? ((Bencodex.Types.Dictionary)_metadata.Bencoded).Add(SignatureKey, Signature)
118118
: _metadata.Bencoded;
119119

120-
/// <summary>
121-
/// Verifies whether the <see cref="Vote"/>'s payload is properly signed by
122-
/// <see cref="Validator"/>.
123-
/// </summary>
124-
/// <returns><see langword="true"/> if the <see cref="Signature"/> is not empty
125-
/// and is a valid signature signed by <see cref="Validator"/>,
126-
/// <see langword="false"/> otherwise.</returns>
127-
[Pure]
128-
public bool Verify() =>
129-
!Signature.IsEmpty &&
130-
ValidatorPublicKey.Verify(
131-
_codec.Encode(_metadata.Bencoded).ToImmutableArray(), Signature);
132-
133120
/// <inheritdoc/>
134121
[Pure]
135122
public bool Equals(Vote? other)

0 commit comments

Comments
 (0)