Skip to content

Commit 947b855

Browse files
committed
hold the timelord_lock when calling signage_point_post_processing() also when receiving a new peak. Also, don't call it for SPs we already have
1 parent 903d48d commit 947b855

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

chia/full_node/full_node.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,16 +1430,21 @@ async def peak_post_processing(
14301430
)
14311431

14321432
if fns_peak_result.new_signage_points is not None and peer is not None:
1433-
for index, sp in fns_peak_result.new_signage_points:
1434-
assert (
1435-
sp.cc_vdf is not None
1436-
and sp.cc_proof is not None
1437-
and sp.rc_vdf is not None
1438-
and sp.rc_proof is not None
1439-
)
1440-
await self.signage_point_post_processing(
1441-
RespondSignagePoint(index, sp.cc_vdf, sp.cc_proof, sp.rc_vdf, sp.rc_proof), peer, sub_slots[1]
1442-
)
1433+
# this is protecting the signage point store, to ensure we only
1434+
# process one at a time and never add the same SP twice
1435+
async with self.timelord_lock:
1436+
for index, sp in fns_peak_result.new_signage_points:
1437+
assert (
1438+
sp.cc_vdf is not None
1439+
and sp.cc_proof is not None
1440+
and sp.rc_vdf is not None
1441+
and sp.rc_proof is not None
1442+
)
1443+
if self.full_node_store.get_signage_point(sp.cc_vdf.output.get_hash()) is not None:
1444+
continue
1445+
await self.signage_point_post_processing(
1446+
RespondSignagePoint(index, sp.cc_vdf, sp.cc_proof, sp.rc_vdf, sp.rc_proof), peer, sub_slots[1]
1447+
)
14431448

14441449
if sub_slots[1] is None:
14451450
assert record.ip_sub_slot_total_iters(self.constants) == 0

0 commit comments

Comments
 (0)