def _get_contexts_for_squash(self, batch_signature):
        """Starting with the batch referenced by batch_signature, iterate back
        through the batches and for each valid batch collect the context_id.
        At the end remove contexts for txns that are other txn's predecessors.

        Args:
            batch_signature (str): The batch to start from, moving back through
                the batches in the scheduler

        Returns:
            (list): Context ids that haven't been previous base contexts.
        """

        batch = self._batches_by_id[batch_signature].batch
        index = self._batches.index(batch)
        contexts = []
        txns_added_predecessors = []
        for b in self._batches[index::-1]:
            batch_is_valid = True
            contexts_from_batch = []
            for txn in b.transactions[::-1]:
                result = self._txn_results[txn.header_signature]
                if not result.is_valid:
                    batch_is_valid = False
                    break
                else:
                    txn_id = txn.header_signature
                    if txn_id not in txns_added_predecessors:
                        txns_added_predecessors.append(
                            self._txn_predecessors[txn_id])
                        contexts_from_batch.append(result.context_id)
            if batch_is_valid:
                contexts.extend(contexts_from_batch)

        return contexts
Starting with the batch referenced by batch_signature, iterate back
        through the batches and for each valid batch collect the context_id.
        At the end remove contexts for txns that are other txn's predecessors.

        Args:
            batch_signature (str): The batch to start from, moving back through
                the batches in the scheduler

        Returns:
            (list): Context ids that haven't been previous base contexts.