def run_recover(b): pre_commit = query.get_pre_commit_state(b.connection, PRE_COMMIT_ID) # Initially the pre-commit collection would be empty if pre_commit: latest_block = query.get_latest_block(b.connection) # NOTE: the pre-commit state can only be ahead of the commited state # by 1 block if latest_block and (latest_block['height'] < pre_commit['height']): query.delete_transactions(b.connection, pre_commit['transactions'])