From a32748cc0f2e5e35db3abb6e130fd991ab5e2f0c Mon Sep 17 00:00:00 2001 From: Tom Cocagne Date: Sat, 5 Jan 2013 23:04:13 -0600 Subject: [PATCH] fixed proposer to override values only if the acceptor has accepted one --- paxos/node.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paxos/node.py b/paxos/node.py index 14a84ec..20fe43e 100644 --- a/paxos/node.py +++ b/paxos/node.py @@ -136,7 +136,10 @@ def recv_promise(self, from_uid, proposal_id, prev_accepted_id, prev_accepted_va if prev_accepted_id > self.last_accepted_id: self.last_accepted_id = prev_accepted_id - self.proposed_value = prev_accepted_value + # Only override the current proposal value if the acceptor has + # accepted one. "None" is not a valid value + if prev_accepted_value is not None: + self.proposed_value = prev_accepted_value if len(self.promises_rcvd) == self.quorum_size: self.leader = True