diff --git a/chia/full_node/mempool_manager.py b/chia/full_node/mempool_manager.py index 048086939b8b..942ef1991188 100644 --- a/chia/full_node/mempool_manager.py +++ b/chia/full_node/mempool_manager.py @@ -336,7 +336,6 @@ async def add_spendbundle( return uint64(cost), MempoolInclusionStatus.SUCCESS, None removal_record_dict: Dict[bytes32, CoinRecord] = {} - removal_coin_dict: Dict[bytes32, Coin] = {} removal_amount: int = 0 for name in removal_names: removal_record = await self.coin_store.get_coin_record(name) @@ -362,9 +361,8 @@ async def add_spendbundle( assert removal_record is not None removal_amount = removal_amount + removal_record.coin.amount removal_record_dict[name] = removal_record - removal_coin_dict[name] = removal_record.coin - removals: List[Coin] = [coin for coin in removal_coin_dict.values()] + removals: List[Coin] = [record.coin for record in removal_record_dict.values()] if addition_amount > removal_amount: return None, MempoolInclusionStatus.FAILED, Err.MINTING_COIN @@ -401,7 +399,6 @@ async def add_spendbundle( # Use this information later when constructing a block fail_reason, conflicts = await self.check_removals(removal_record_dict) # If there is a mempool conflict check if this spendbundle has a higher fee per cost than all others - tmp_error: Optional[Err] = None conflicting_pool_items: Dict[bytes32, MempoolItem] = {} if fail_reason is Err.MEMPOOL_CONFLICT: for conflicting in conflicts: @@ -421,9 +418,6 @@ async def add_spendbundle( elif fail_reason: return None, MempoolInclusionStatus.FAILED, fail_reason - if tmp_error: - return None, MempoolInclusionStatus.FAILED, tmp_error - # Verify conditions, create hash_key list for aggsig check error: Optional[Err] = None for npc in npc_list: @@ -487,7 +481,7 @@ async def check_removals(self, removals: Dict[bytes32, CoinRecord]) -> Tuple[Opt for record in removals.values(): removal = record.coin # 1. Checks if it's been spent already - if record.spent == 1: + if record.spent: return Err.DOUBLE_SPEND, [] # 2. Checks if there's a mempool conflict if removal.name() in self.mempool.removals: