'This method cleans up all unlinked tx\'es found in table
`unlinked_tx` except where the tx hash is provided in known_tx'

def clean_unlinked_tx(store, known_tx=set()):

    rows = store.selectall('\n                                                SELECT    ut.tx_id,    t.tx_hash\n                                                    FROM    unlinked_tx    ut\n                                                    JOIN    tx    t    ON    (ut.tx_id    =    t.tx_id)')
    if (not rows):
        return
    if (type(known_tx) is not set):
        known_tx = set(known_tx)
    txcount = 0
    for (tx_id, tx_hash) in rows:
        if (store.hashout_hex(tx_hash) in known_tx):
            continue
        store.log.debug('Removing    unlinked    tx:    %r', tx_hash)
        store._clean_unlinked_tx(tx_id)
        txcount += 1
    if txcount:
        store.commit()
        store.log.info('Cleaned    up    %d    unlinked    transactions', txcount)
    else:
        store.log.info('No    unlinked    transactions    to    clean    up')
