@@ -1639,16 +1639,23 @@ async def peak_post_processing(
1639
1639
)
1640
1640
1641
1641
if fns_peak_result .new_signage_points is not None and peer is not None :
1642
- for index , sp in fns_peak_result .new_signage_points :
1643
- assert (
1644
- sp .cc_vdf is not None
1645
- and sp .cc_proof is not None
1646
- and sp .rc_vdf is not None
1647
- and sp .rc_proof is not None
1648
- )
1649
- await self .signage_point_post_processing (
1650
- RespondSignagePoint (index , sp .cc_vdf , sp .cc_proof , sp .rc_vdf , sp .rc_proof ), peer , sub_slots [1 ]
1651
- )
1642
+ # this is protecting the signage point store, to ensure we only
1643
+ # process one at a time and never add the same SP twice
1644
+ async with self .timelord_lock :
1645
+ for index , sp in fns_peak_result .new_signage_points :
1646
+ assert (
1647
+ sp .cc_vdf is not None
1648
+ and sp .cc_proof is not None
1649
+ and sp .rc_vdf is not None
1650
+ and sp .rc_proof is not None
1651
+ )
1652
+ sphash = sp .cc_vdf .output .get_hash ()
1653
+ if self .full_node_store .get_signage_point (sphash ) is not None :
1654
+ self .log .debug ("signage point already processed, skipping: %s" , sphash )
1655
+ continue
1656
+ await self .signage_point_post_processing (
1657
+ RespondSignagePoint (index , sp .cc_vdf , sp .cc_proof , sp .rc_vdf , sp .rc_proof ), peer , sub_slots [1 ]
1658
+ )
1652
1659
1653
1660
if sub_slots [1 ] is None :
1654
1661
assert record .ip_sub_slot_total_iters (self .constants ) == 0
0 commit comments