Skip to content

Commit e3853fe

Browse files
committed
Revert "Move GeneratorBlockInfo."
This reverts commit f077801.
1 parent 8591c91 commit e3853fe

File tree

4 files changed

+11
-20
lines changed

4 files changed

+11
-20
lines changed

chia/_tests/core/full_node/stores/test_block_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
from chia.consensus.blockchain import AddBlockResult, Blockchain
2323
from chia.consensus.default_constants import DEFAULT_CONSTANTS
2424
from chia.consensus.full_block_to_block_record import header_block_to_sub_block_record
25-
from chia.consensus.generator_block_info import GeneratorBlockInfo
2625
from chia.full_node.block_store import BlockStore
2726
from chia.full_node.coin_store import CoinStore
27+
from chia.full_node.full_block_utils import GeneratorBlockInfo
2828
from chia.simulator.block_tools import BlockTools
2929
from chia.simulator.wallet_tools import WalletTool
3030
from chia.types.blockchain_format.serialized_program import SerializedProgram

chia/consensus/generator_block_info.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

chia/full_node/block_store.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
from chia_rs.sized_bytes import bytes32
1313
from chia_rs.sized_ints import uint32
1414

15-
from chia.consensus.generator_block_info import GeneratorBlockInfo
16-
from chia.full_node.full_block_utils import block_info_from_block, generator_from_block
15+
from chia.full_node.full_block_utils import GeneratorBlockInfo, block_info_from_block, generator_from_block
1716
from chia.util.batches import to_batches
1817
from chia.util.db_wrapper import DBWrapper2, execute_fetchone
1918
from chia.util.errors import Err

chia/full_node/full_block_utils.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from __future__ import annotations
22

3+
from dataclasses import dataclass
34
from typing import Callable, Optional
45

56
from chia_rs import G1Element, G2Element, TransactionsInfo, serialized_length
67
from chia_rs.sized_bytes import bytes32
78
from chia_rs.sized_ints import uint32
89
from chiabip158 import PyBIP158
910

10-
from chia.consensus.generator_block_info import GeneratorBlockInfo
1111
from chia.types.blockchain_format.coin import Coin
1212
from chia.types.blockchain_format.serialized_program import SerializedProgram
1313

@@ -224,6 +224,14 @@ def generator_from_block(buf: memoryview) -> Optional[bytes]:
224224
return bytes(buf[:length])
225225

226226

227+
# this implements the BlockInfo protocol
228+
@dataclass(frozen=True)
229+
class GeneratorBlockInfo:
230+
prev_header_hash: bytes32
231+
transactions_generator: Optional[SerializedProgram]
232+
transactions_generator_ref_list: list[uint32]
233+
234+
227235
def block_info_from_block(buf: memoryview) -> GeneratorBlockInfo:
228236
buf = skip_list(buf, skip_end_of_sub_slot_bundle) # finished_sub_slots
229237
buf = skip_reward_chain_block(buf) # reward_chain_block

0 commit comments

Comments
 (0)