diff --git a/CHANGES.md b/CHANGES.md
index d8ccc8e00c6..3f0e1b4b0a4 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -42,10 +42,17 @@ To be released.
- Added `IAccountStateDeltaView.GetValidatorSet()` interface method.
[[#3247]]
- Added `IAccountStateDelta.SetValidator()` interface method. [[#3247]]
+ - `Vote.BlockHash` property became `BlockHash` type. (was `BlockHash?`)
+ [[#3249]]
+ - `VoteMetadata(long, int, BlockHash?, DateTimeOffset, PublicKey, VoteFlag)`
+ constructor became
+ `VoteMetadata(long, int, BlockHash, DateTimeOffset, PublicKey, VoteFlag)`
+ [[#3249]]
- (Libplanet.Net) Renamed `Step` enum to `ConsensusStep`
to remove ambiguity. [[#3249]]
- (Libplanet.Net) `ConsensusProposalMsg`, `ConsensusPreVoteMsg` and
`ConsensusPreCommitMsg` became to inherit `ConsensusVoteMsg`. [[#3249]]
+ - (Libplanet.Net) Removed `ConsensusMsg.BlockHash` property. [[#3249]]
### Backward-incompatible network protocol changes
diff --git a/Libplanet.Net/Consensus/Context.Mutate.cs b/Libplanet.Net/Consensus/Context.Mutate.cs
index 99b213ac338..f81ea437723 100644
--- a/Libplanet.Net/Consensus/Context.Mutate.cs
+++ b/Libplanet.Net/Consensus/Context.Mutate.cs
@@ -301,7 +301,7 @@ private void ProcessGenericUponRules()
BroadcastMessage(
new ConsensusPreCommitMsg(MakeVote(Round, default, VoteFlag.PreCommit)));
}
- else if (!(Proposal is null) && !hash3.Equals(Proposal.BlockHash))
+ else if (Proposal is { } proposal && !proposal.BlockHash.Equals(hash3))
{
// +2/3 votes were collected and is not equal to proposal's,
// remove invalid proposal.
diff --git a/Libplanet.Net/Consensus/HeightVoteSet.cs b/Libplanet.Net/Consensus/HeightVoteSet.cs
index 1ba4b16dc64..8a2ab23ca6e 100644
--- a/Libplanet.Net/Consensus/HeightVoteSet.cs
+++ b/Libplanet.Net/Consensus/HeightVoteSet.cs
@@ -178,7 +178,7 @@ public void AddVote(Vote vote)
}
}
- voteSet.AddVerifiedVote(vote);
+ voteSet.AddVote(vote);
}
}
@@ -230,12 +230,12 @@ public VoteSet PreCommits(int round)
/// Thrown when given
/// is not either or .
///
+ /// Thrown when there's no
+ /// exists for given .
+ ///
public VoteSet GetVoteSet(int round, VoteFlag voteFlag)
{
- RoundVoteSet roundVoteSet;
-
- // TODO: Check if try-catch is needed for KeyNotFoundException.
- roundVoteSet = _roundVoteSets[round];
+ RoundVoteSet roundVoteSet = _roundVoteSets[round];
return voteFlag switch
{
VoteFlag.PreVote => roundVoteSet.PreVotes,
diff --git a/Libplanet.Net/Consensus/VoteSet.cs b/Libplanet.Net/Consensus/VoteSet.cs
index 4439c0782e7..9bf9a503faf 100644
--- a/Libplanet.Net/Consensus/VoteSet.cs
+++ b/Libplanet.Net/Consensus/VoteSet.cs
@@ -260,7 +260,7 @@ public bool TwoThirdsMajority(out BlockHash blockHash)
_height, _round, _maj23!.Value, MappedList().ToImmutableArray());
}
- internal void AddVerifiedVote(Vote vote)
+ internal void AddVote(Vote vote)
{
if (vote.Round != _round ||
vote.Flag != _voteType)
@@ -283,7 +283,7 @@ internal void AddVerifiedVote(Vote vote)
if (existing.BlockHash.Equals(vote.BlockHash))
{
throw new InvalidVoteException(
- $"{nameof(AddVerifiedVote)}() does not expect duplicate votes",
+ $"{nameof(AddVote)}() does not expect duplicate votes",
vote);
}
else