Skip to content

Commit 8a76d90

Browse files
committed
Be explicit about falling back to coin_puzzle_hash index in get_unspent_lineage_info_for_puzzle_hash.
1 parent b1cc0a5 commit 8a76d90

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

chia/full_node/coin_store.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ class CoinStore:
3030
"""
3131

3232
db_wrapper: DBWrapper2
33+
# Fall back to the `coin_puzzle_hash` index if the ff unspent index
34+
# does not exist.
35+
_unspent_lineage_for_ph_idx: str = "coin_puzzle_hash"
3336

3437
@classmethod
3538
async def create(cls, db_wrapper: DBWrapper2) -> CoinStore:
@@ -82,6 +85,7 @@ async def create(cls, db_wrapper: DBWrapper2) -> CoinStore:
8285
WHERE spent_index = -1
8386
"""
8487
)
88+
self._unspent_lineage_for_ph_idx = "coin_record_ph_ff_unspent_idx"
8589

8690
return self
8791

@@ -639,6 +643,7 @@ async def get_unspent_lineage_info_for_puzzle_hash(self, puzzle_hash: bytes32) -
639643
"unspent.coin_parent, "
640644
"parent.coin_parent "
641645
"FROM coin_record AS unspent "
646+
f"INDEXED BY {self._unspent_lineage_for_ph_idx} "
642647
"LEFT JOIN coin_record AS parent ON unspent.coin_parent = parent.coin_name "
643648
"WHERE unspent.spent_index = -1 "
644649
"AND parent.spent_index > 0 "

0 commit comments

Comments
 (0)