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

Code before:
                spend_data=spend_data,
                fast_forward_spends=self.fast_forward_spends,
            )
            new_bundle_coin_spends[new_coin_spend.coin.name()] = BundleCoinSpend(
                coin_spend=new_coin_spend,
                eligible_for_dedup=spend_data.eligible_for_dedup,
                eligible_for_fast_forward=spend_data.eligible_for_fast_forward,
                additions=patched_additions,
                cost=spend_data.cost,
            )
            # Update the list of coins spends that make the new fast forward bundle
            new_coin_spends.append(new_coin_spend)
            fast_forwarded_spends += 1
        if fast_forwarded_spends == 0:
            # This item doesn't have any fast forward coins, nothing to do here
            return new_bundle_coin_spends
        # Update the mempool item after validating the new spend bundle
        new_sb = SpendBundle(
            coin_spends=new_coin_spends, aggregated_signature=mempool_item.spend_bundle.aggregated_signature
        )
        assert mempool_item.conds is not None
        try:
            # Run the new spend bundle to make sure it remains valid. What we
            # care about here is whether this call throws or not.
            get_conditions_from_spendbundle(new_sb, mempool_item.conds.cost, constants, height)
        # get_conditions_from_spendbundle raises a TypeError with an error code
        except ValueError as e:
            # Convert that to a ValidationError
            if len(e.args) > 1:
                error = Err(e.args[1])
                raise ValueError(f"Mempool item became invalid after singleton fast forward with error {error}.")
            else:
                raise ValueError(
                    "Mempool item became invalid after singleton fast forward with an unspecified error."
                )  # pragma: no cover
        return new_bundle_coin_spends


Review comment (suggestion):
```suggestion
        # get_conditions_from_spendbundle raises a ValueError with an error code
```

Code after:
                spend_data=spend_data,
                fast_forward_spends=self.fast_forward_spends,
            )
            new_bundle_coin_spends[new_coin_spend.coin.name()] = BundleCoinSpend(
                coin_spend=new_coin_spend,
                eligible_for_dedup=spend_data.eligible_for_dedup,
                eligible_for_fast_forward=spend_data.eligible_for_fast_forward,
                additions=patched_additions,
                cost=spend_data.cost,
            )
            # Update the list of coins spends that make the new fast forward bundle
            new_coin_spends.append(new_coin_spend)
            fast_forwarded_spends += 1
        if fast_forwarded_spends == 0:
            # This item doesn't have any fast forward coins, nothing to do here
            return new_bundle_coin_spends
        # Update the mempool item after validating the new spend bundle
        new_sb = SpendBundle(
            coin_spends=new_coin_spends, aggregated_signature=mempool_item.spend_bundle.aggregated_signature
        )
        assert mempool_item.conds is not None
        try:
            # Run the new spend bundle to make sure it remains valid. What we
            # care about here is whether this call throws or not.
            get_conditions_from_spendbundle(new_sb, mempool_item.conds.cost, constants, height)
        # get_conditions_from_spendbundle raises a ValueError with an error code
        except ValueError as e:
            # Convert that to a ValidationError
            if len(e.args) > 1:
                error = Err(e.args[1])
                raise ValueError(f"Mempool item became invalid after singleton fast forward with error {error}.")
            else:
                raise ValueError(
                    "Mempool item became invalid after singleton fast forward with an unspecified error."
                )  # pragma: no cover
        return new_bundle_coin_spends