func (this *Paxos) doSaveLearner(state *thispb.LearnerState) { if this.chosenValue != nil { state.ChosenValue = append([]byte{}, this.chosenValue...) return } for ballot, acceptorSet := range this.ballotAcceptorsMap { votedValue := append([]byte{}, this.ballotValueMap[ballot]...) for acceptor := range acceptorSet { state.VotedBallotList = append(state.VotedBallotList, ballot) state.VotedAcceptorList = append(state.VotedAcceptorList, acceptor) state.VotedValueList = append(state.VotedValueList, votedValue) // Store only one copy of the ballot value for each unique ballot. votedValue = nil } } }