Skip to content

Commit 74d5c45

Browse files
authored
[CHIA-3654] previous transaction block height in BlockTools (#19962)
previous transaction block height in BlockTools
1 parent ecb5148 commit 74d5c45

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

chia/simulator/block_tools.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,6 @@ def get_consecutive_blocks(
965965
block_list.append(full_block)
966966

967967
if include_transactions:
968-
prev_tx_height = full_block.height
969968
for coin in full_block.get_included_reward_coins():
970969
if coin.puzzle_hash == self.farmer_ph:
971970
pending_rewards.append(coin)
@@ -979,6 +978,7 @@ def get_consecutive_blocks(
979978

980979
if full_block.transactions_generator is not None:
981980
tx_block_heights.append(full_block.height)
981+
prev_tx_height = full_block.height
982982

983983
blocks_added_this_sub_slot += 1
984984
blocks[full_block.header_hash] = block_record
@@ -1259,7 +1259,6 @@ def get_consecutive_blocks(
12591259
block_list.append(full_block)
12601260

12611261
if include_transactions:
1262-
prev_tx_height = full_block.height
12631262
for coin in full_block.get_included_reward_coins():
12641263
if coin.puzzle_hash == self.farmer_ph:
12651264
pending_rewards.append(coin)
@@ -1273,6 +1272,7 @@ def get_consecutive_blocks(
12731272

12741273
if full_block.transactions_generator is not None:
12751274
tx_block_heights.append(full_block.height)
1275+
prev_tx_height = full_block.height
12761276

12771277
blocks_added_this_sub_slot += 1
12781278
blocks[full_block.header_hash] = block_record
@@ -1759,6 +1759,7 @@ def load_block_list(
17591759
sub_slot_iters = uint64(constants.SUB_SLOT_ITERS_STARTING)
17601760
height_to_hash: dict[uint32, bytes32] = {}
17611761
blocks: dict[bytes32, BlockRecord] = {}
1762+
prev_transaction_b_height = uint32(0)
17621763
for full_block in block_list:
17631764
if full_block.height != 0:
17641765
if len(full_block.finished_sub_slots) > 0:
@@ -1775,7 +1776,6 @@ def load_block_list(
17751776
sp_hash = full_block.reward_chain_block.challenge_chain_sp_vdf.output.get_hash()
17761777

17771778
cache = BlockCache(blocks)
1778-
prev_transaction_b_height = uint32(0) # TODO: todo_v2_plots
17791779

17801780
required_iters = validate_pospace_and_get_required_iters(
17811781
constants,
@@ -1789,6 +1789,9 @@ def load_block_list(
17891789
)
17901790
assert required_iters is not None
17911791

1792+
if full_block.is_transaction_block():
1793+
prev_transaction_b_height = full_block.height
1794+
17921795
blocks[full_block.header_hash] = block_to_block_record(
17931796
constants,
17941797
cache,

0 commit comments

Comments
 (0)