From fcfe0fe21ce7ea265e319e2016d680fe14c91030 Mon Sep 17 00:00:00 2001 From: Mariano Date: Mon, 1 Mar 2021 16:34:51 +0900 Subject: [PATCH] Fix edge case --- src/consensus/difficulty_adjustment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/consensus/difficulty_adjustment.py b/src/consensus/difficulty_adjustment.py index 3b80cb6e73..7262ce75e1 100644 --- a/src/consensus/difficulty_adjustment.py +++ b/src/consensus/difficulty_adjustment.py @@ -126,11 +126,11 @@ def _get_second_to_last_transaction_block_in_previous_epoch( fetched_index += 1 # Backtrack to find the second to last tx block - found_tx_block = 0 + found_tx_block = 1 if curr_b.is_transaction_block else 0 while found_tx_block < 2: + curr_b = blocks.block_record(curr_b.prev_hash) if curr_b.is_transaction_block: found_tx_block += 1 - curr_b = blocks.block_record(curr_b.prev_hash) return curr_b