    def rollback(cls, bigchain, new_height, txn_ids):
        """Looks for election and vote transactions inside the block and
           cleans up the database artifacts possibly created in `process_blocks`.

           Part of the `end_block`/`commit` crash recovery.
        """

        # delete election records for elections initiated at this height and
        # elections concluded at this height
        bigchain.delete_elections(new_height)

        txns = [bigchain.get_transaction(tx_id) for tx_id in txn_ids]

        elections = cls._get_votes(txns)
        for election_id in elections:
            election = bigchain.get_transaction(election_id)
            election.on_rollback(bigchain, new_height)
Looks for election and vote transactions inside the block and
cleans up the database artifacts possibly created in `process_blocks`.

Part of the `end_block`/`commit` crash recovery.
bigchaindb/elections/election.py