def modify_mempool(mempool, remove=0, add=0, verbose=False):
    """
    Given a list of txids (mempool), add and remove some items to simulate
    an out of sync mempool.
    """
    for i in range(remove):
        popped = mempool.pop()
        if verbose: print("removed:", popped)

    for i in range(add):
        new_txid = _make_txid()
        mempool.append(new_txid)
        if verbose: print("added:", new_txid)

    return mempool