Skip to content

Commit

Permalink
CHIA-944 Simplify Mempool's get_items_by_coin_ids (#18326)
Browse files Browse the repository at this point in the history
Simplify Mempool's get_items_by_coin_ids.
  • Loading branch information
AmineKhaldi authored Jul 30, 2024
1 parent 9ff36d9 commit e5b1e85
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions chia/full_node/mempool.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,11 @@ def get_items_by_coin_ids(self, spent_coin_ids: List[bytes32]) -> List[MempoolIt
items: List[MempoolItem] = []
for batch in to_batches(spent_coin_ids, SQLITE_MAX_VARIABLE_NUMBER):
args = ",".join(["?"] * len(batch.entries))
with self._db_conn:
cursor = self._db_conn.execute(
f"SELECT * FROM tx WHERE name IN (SELECT tx FROM spends WHERE coin_id IN ({args}))",
tuple(batch.entries),
)
items.extend(self._row_to_item(row) for row in cursor)
cursor = self._db_conn.execute(
f"SELECT * FROM tx WHERE name IN (SELECT tx FROM spends WHERE coin_id IN ({args}))",
tuple(batch.entries),
)
items.extend(self._row_to_item(row) for row in cursor)
return items

def get_min_fee_rate(self, cost: int) -> Optional[float]:
Expand Down

0 comments on commit e5b1e85

Please sign in to comment.