From 1912201252579c050610c4a93ccfc05356647872 Mon Sep 17 00:00:00 2001 From: Dhia Ayachi Date: Tue, 2 Apr 2024 10:27:42 -0400 Subject: [PATCH] remove `Candidate` field from pre-vote request --- commands.go | 3 --- raft.go | 6 ++---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/commands.go b/commands.go index af6a8505..1ec76cb2 100644 --- a/commands.go +++ b/commands.go @@ -128,9 +128,6 @@ type RequestPreVoteRequest struct { // Provide the term and our id Term uint64 - // Deprecated: use RPCHeader.Addr instead - Candidate []byte - // Used to ensure safety LastLogIndex uint64 LastLogTerm uint64 diff --git a/raft.go b/raft.go index cbb12d94..d809257b 100644 --- a/raft.go +++ b/raft.go @@ -2059,10 +2059,8 @@ func (r *Raft) preElectSelf() <-chan *preVoteResult { // Construct the request lastIdx, lastTerm := r.getLastEntry() req := &RequestPreVoteRequest{ - RPCHeader: r.getRPCHeader(), - Term: newTerm, - // this is needed for retro compatibility, before RPCHeader.Addr was added - Candidate: r.trans.EncodePeer(r.localID, r.localAddr), + RPCHeader: r.getRPCHeader(), + Term: newTerm, LastLogIndex: lastIdx, LastLogTerm: lastTerm, }