def add_to_pool(self, item: MempoolItem):
    "\n        Adds an item to the mempool by kicking out transactions (if it doesn't fit), in order of increasing fee per cost\n        "
    while self.at_full_capacity(item.cost):
        (fee_per_cost, val) = self.sorted_spends.peekitem(index=0)
        to_remove = list(val.values())[0]
        self.remove_from_pool(to_remove)
    self.spends[item.name] = item
    if (item.fee_per_cost not in self.sorted_spends):
        self.sorted_spends[item.fee_per_cost] = {}
    self.sorted_spends[item.fee_per_cost][item.name] = item
    for add in item.additions:
        self.additions[add.name()] = item
    for coin in item.removals:
        self.removals[coin.name()] = item
    self.total_mempool_cost += item.cost
Adds an item to the mempool by kicking out transactions (if it doesn't fit), in order of increasing fee per cost
def add_to_pool(self, item: MempoolItem):
    "\n        \n        "
    while self.at_full_capacity(item.cost):
        (fee_per_cost, val) = self.sorted_spends.peekitem(index=0)
        to_remove = list(val.values())[0]
        self.remove_from_pool(to_remove)
    self.spends[item.name] = item
    if (item.fee_per_cost not in self.sorted_spends):
        self.sorted_spends[item.fee_per_cost] = {}
    self.sorted_spends[item.fee_per_cost][item.name] = item
    for add in item.additions:
        self.additions[add.name()] = item
    for coin in item.removals:
        self.removals[coin.name()] = item
    self.total_mempool_cost += item.cost