Skip to content

Commit dbd6700

Browse files
authored
fix sp lookup at genesis (#20057)
* fix genesis sp lookup * fix test * lint
1 parent 83e164d commit dbd6700

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

chia/_tests/core/full_node/test_full_node.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,7 +1882,9 @@ async def test_new_signage_point_caching(
18821882
) -> None:
18831883
full_node_1, _full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes
18841884
blocks = await full_node_1.get_all_full_blocks()
1885-
1885+
assert full_node_1.full_node.full_node_store.get_signage_point_by_index_and_cc_output(
1886+
bytes32.zeros, full_node_1.full_node.constants.GENESIS_CHALLENGE, uint8(0)
1887+
) == SignagePoint(None, None, None, None)
18861888
peer = await connect_and_get_peer(server_1, server_2, self_hostname)
18871889
blocks = bt.get_consecutive_blocks(3, block_list_input=blocks, skip_slots=2)
18881890
await full_node_1.full_node.add_block(blocks[-3])
@@ -1951,10 +1953,6 @@ async def test_new_signage_point_caching(
19511953
is not None
19521954
)
19531955

1954-
assert full_node_1.full_node.full_node_store.get_signage_point_by_index_and_cc_output(
1955-
full_node_1.full_node.constants.GENESIS_CHALLENGE, bytes32.zeros, uint8(0)
1956-
) == SignagePoint(None, None, None, None)
1957-
19581956

19591957
@pytest.mark.anyio
19601958
async def test_slot_catch_up_genesis(

chia/full_node/full_node_store.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -833,10 +833,12 @@ def get_signage_point_by_index_and_cc_output(
833833
self, cc_signage_point: bytes32, challenge: bytes32, index: uint8
834834
) -> Optional[SignagePoint]:
835835
assert len(self.finished_sub_slots) >= 1
836-
if cc_signage_point == self.constants.GENESIS_CHALLENGE:
837-
return SignagePoint(None, None, None, None)
838836
for sub_slot, sps, _ in self.finished_sub_slots:
839-
if sub_slot is not None and sub_slot.challenge_chain.get_hash() == challenge:
837+
if sub_slot is not None:
838+
cc_hash = sub_slot.challenge_chain.get_hash()
839+
else:
840+
cc_hash = self.constants.GENESIS_CHALLENGE
841+
if cc_hash == challenge:
840842
if index == 0:
841843
# first SP in the sub slot
842844
return SignagePoint(None, None, None, None)

0 commit comments

Comments
 (0)