Repository: Chia-Network/chia-blockchain
File: chia/full_node/mempool_manager.py (Python)

Code before:
            f"for {spend_bundle_id} (queue-size: {self._worker_queue_size})",
        )
        return sbc

    async def add_spend_bundle(
        self,
        new_spend: SpendBundle,
        conds: SpendBundleConditions,
        spend_name: bytes32,
        first_added_height: uint32,
        get_coin_records: Optional[Callable[[Collection[bytes32]], Awaitable[list[CoinRecord]]]] = None,
        get_unspent_lineage_info_for_puzzle_hash: Optional[
            Callable[[bytes32], Awaitable[Optional[UnspentLineageInfo]]]
        ] = None,
    ) -> SpendBundleAddInfo:
        """
        Validates and adds to mempool a new_spend with the given
        SpendBundleConditions, and spend_name, and the current mempool. The mempool
        should be locked during this call (blockchain lock). If there are mempool
        conflicts, the conflicting spends might be removed (if the new spend is
        a superset of the previous). Otherwise, the new spend might be
        added to the potential pool.

        Args:
            new_spend: spend bundle to validate and add
            conds: the SpendBundleConditions resulting from running the clvm in the SpendBundles coin spends
            spend_name: hash of the spend bundle data, passed in as an optimization

        Returns:
            Optional[uint64]: cost of the entire transaction, None iff status is FAILED
            MempoolInclusionStatus:  SUCCESS (should add to pool), FAILED (cannot add), and PENDING (can add later)
            list[MempoolRemoveInfo]: conflicting mempool items which were removed, if no Err
            Optional[Err]: Err is set iff status is FAILED
        """

        # Skip if already added
        existing_item = self.mempool.get_item_by_id(spend_name)
        if existing_item is not None:
            return SpendBundleAddInfo(existing_item.cost, MempoolInclusionStatus.SUCCESS, [], None)

        if get_coin_records is None:
            get_coin_records = self.get_coin_records

        if get_unspent_lineage_info_for_puzzle_hash is None:
            get_unspent_lineage_info_for_puzzle_hash = self.get_unspent_lineage_info_for_puzzle_hash

        err, item, remove_items = await self.validate_spend_bundle(
            new_spend,
            conds,
            spend_name,
            first_added_height,

Review comment (suggestion):
We're only dealing with a single spend bundle, and in consistency with the rest of args docs I would make it:
```suggestion
            conds: SpendBundleConditions resulting from running the clvm in the spend bundle's coin spends
```

Code after:
            f"for {spend_bundle_id} (queue-size: {self._worker_queue_size})",
        )
        return sbc

    async def add_spend_bundle(
        self,
        new_spend: SpendBundle,
        conds: SpendBundleConditions,
        spend_name: bytes32,
        first_added_height: uint32,
        get_coin_records: Optional[Callable[[Collection[bytes32]], Awaitable[list[CoinRecord]]]] = None,
        get_unspent_lineage_info_for_puzzle_hash: Optional[
            Callable[[bytes32], Awaitable[Optional[UnspentLineageInfo]]]
        ] = None,
    ) -> SpendBundleAddInfo:
        """
        Validates and adds to mempool a new_spend with the given
        SpendBundleConditions, and spend_name, and the current mempool. The mempool
        should be locked during this call (blockchain lock). If there are mempool
        conflicts, the conflicting spends might be removed (if the new spend is
        a superset of the previous). Otherwise, the new spend might be
        added to the potential pool.

        Args:
            new_spend: spend bundle to validate and add
            conds: SpendBundleConditions resulting from running the clvm in the spend bundle's coin spends
            spend_name: hash of the spend bundle data, passed in as an optimization

        Returns:
            Optional[uint64]: cost of the entire transaction, None iff status is FAILED
            MempoolInclusionStatus:  SUCCESS (should add to pool), FAILED (cannot add), and PENDING (can add later)
            list[MempoolRemoveInfo]: conflicting mempool items which were removed, if no Err
            Optional[Err]: Err is set iff status is FAILED
        """

        # Skip if already added
        existing_item = self.mempool.get_item_by_id(spend_name)
        if existing_item is not None:
            return SpendBundleAddInfo(existing_item.cost, MempoolInclusionStatus.SUCCESS, [], None)

        if get_coin_records is None:
            get_coin_records = self.get_coin_records

        if get_unspent_lineage_info_for_puzzle_hash is None:
            get_unspent_lineage_info_for_puzzle_hash = self.get_unspent_lineage_info_for_puzzle_hash

        err, item, remove_items = await self.validate_spend_bundle(
            new_spend,
            conds,
            spend_name,
            first_added_height,