Skip to content

process new signage points no more than once #15624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions chia/full_node/full_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -1639,16 +1639,23 @@ async def peak_post_processing(
)

if fns_peak_result.new_signage_points is not None and peer is not None:
for index, sp in fns_peak_result.new_signage_points:
assert (
sp.cc_vdf is not None
and sp.cc_proof is not None
and sp.rc_vdf is not None
and sp.rc_proof is not None
)
await self.signage_point_post_processing(
RespondSignagePoint(index, sp.cc_vdf, sp.cc_proof, sp.rc_vdf, sp.rc_proof), peer, sub_slots[1]
)
# this is protecting the signage point store, to ensure we only
# process one at a time and never add the same SP twice
async with self.timelord_lock:
for index, sp in fns_peak_result.new_signage_points:
assert (
sp.cc_vdf is not None
and sp.cc_proof is not None
and sp.rc_vdf is not None
and sp.rc_proof is not None
)
sphash = sp.cc_vdf.output.get_hash()
if self.full_node_store.get_signage_point(sphash) is not None:
self.log.debug("signage point already processed, skipping: %s", sphash)
continue
await self.signage_point_post_processing(
RespondSignagePoint(index, sp.cc_vdf, sp.cc_proof, sp.rc_vdf, sp.rc_proof), peer, sub_slots[1]
)

if sub_slots[1] is None:
assert record.ip_sub_slot_total_iters(self.constants) == 0
Expand Down
4 changes: 2 additions & 2 deletions chia/full_node/full_node_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,11 @@ def add_to_future_sp(self, signage_point: SignagePoint, index: uint8) -> None:
or signage_point.cc_proof is None
or signage_point.rc_proof is None
):
return None
return
if signage_point.rc_vdf.challenge not in self.future_sp_cache:
self.future_sp_cache[signage_point.rc_vdf.challenge] = []
if self.in_future_sp_cache(signage_point, index):
return None
return

self.future_cache_key_times[signage_point.rc_vdf.challenge] = int(time.time())
self.future_sp_cache[signage_point.rc_vdf.challenge].append((index, signage_point))
Expand Down
Loading