-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch_proposal.patch
More file actions
26 lines (24 loc) · 847 Bytes
/
patch_proposal.patch
File metadata and controls
26 lines (24 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--- simulations/engine.py
+++ simulations/engine.py
@@ -16,11 +16,18 @@
self.y_t_no = 0.0
def cast_vote(self, agent_id, amount, vote, current_epoch):
- self.votes[agent_id] = {
- "amount": amount,
- "epoch_staked": current_epoch,
- "vote": vote
- }
+ if agent_id in self.votes:
+ if self.votes[agent_id]["vote"] != vote:
+ self.votes[agent_id]["epoch_staked"] = current_epoch
+ self.votes[agent_id]["vote"] = vote
+
+ self.votes[agent_id]["amount"] = amount
+ else:
+ self.votes[agent_id] = {
+ "amount": amount,
+ "epoch_staked": current_epoch,
+ "vote": vote
+ }
def update_conviction(self, alpha, t_max, current_epoch):
v_t_yes = 0.0