Skip to content
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

logging for look_in_fork #18850

Open
wants to merge 5 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
4 changes: 4 additions & 0 deletions chia/consensus/block_body_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ async def validate_block_body(
return Err.DOUBLE_SPEND, None
removal_coin_records[unspent.name] = unspent
else:
log.error(f"look_in_fork {unspent.name} {unspent.confirmed_block_index} > {fork_info.fork_height}")
look_in_fork.append(unspent.name)

if len(unspent_records) != len(removals_from_db):
Expand All @@ -422,6 +423,9 @@ async def validate_block_body(
for rem in removals_from_db:
if rem in found:
continue
log.error(
f"look_in_fork {rem} {len(unspent_records)} != {len(removals_from_db)} and rem not in removals_from_db"
)
look_in_fork.append(rem)

for rem in look_in_fork:
Expand Down
6 changes: 6 additions & 0 deletions chia/consensus/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,14 +534,19 @@ async def _reconsider_peak(
rolled_back_state: Dict[bytes32, CoinRecord] = {}

if genesis and peak is not None:
log.error(f"WJB genesis and peak is not None")
return [], None

if peak is not None:
if block_record.weight < peak.weight:
# This is not a heavier block than the heaviest we have seen, so we don't change the coin set
log.error(f"WJB {block_record.weight} < {peak.weight}")
return [], None
if block_record.weight == peak.weight and peak.total_iters <= block_record.total_iters:
# this is an equal weight block but our peak has lower iterations, so we dont change the coin set
log.error(
f"WJB {block_record.weight} == {peak.weight} and {peak.total_iters} <= {block_record.total_iters}"
)
return [], None

if block_record.prev_hash != peak.header_hash:
Expand Down Expand Up @@ -582,6 +587,7 @@ async def _reconsider_peak(
coin_id for coin_id, fork_rem in fork_info.removals_since_fork.items() if fork_rem.height == height
]
assert fetched_block_record.timestamp is not None
log.error(f"WJB tx_additions {tx_additions} WJB tx_removals {tx_removals}")
await self.coin_store.new_block(
height,
fetched_block_record.timestamp,
Expand Down
Loading