Example #1
0
func (i *instance) OneATxnVotesReceived(proposal *msgs.TxnVoteProposal, promise *msgs.TxnVotePromise) {
	promise.SetRoundNumber(proposal.RoundNumber())
	roundNumber := paxosNumber(proposal.RoundNumber())
	if roundNumber >= i.promiseNum {
		i.promiseNum = roundNumber
		if i.accepted == nil {
			promise.SetFreeChoice()
		} else {
			promise.SetAccepted()
			accepted := promise.Accepted()
			accepted.SetRoundNumber(uint64(i.acceptedNum))
			accepted.SetBallot(*i.accepted)
		}
	} else {
		promise.SetRoundNumberTooLow(uint32(i.promiseNum >> 32))
	}
}
Example #2
0
func (oneA *proposalOneA) addOneAToProposal(proposalCap *msgs.TxnVoteProposal, sender *proposalSender) {
	proposalCap.SetVarId(oneA.ballot.VarUUId[:])
	proposalCap.SetRoundNumber(uint64(oneA.currentRoundNumber))
	oneA.oneASender = sender
	oneA.nextState(nil)
}