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