WIP Almost complete refactoring and unit testing of routingtable. Minor refactoring of kbucket.

Very WIP. I will describe tomorrow; really tired now.

### Bugs found:
* Many operations are potentially thread-unsafe.
* The `replacement_cache` isn't synchronized once a `KBucket` is split.
Looking at setup_db.py clarifies some things. market_id is used as an id for the table MARKETS of the database. What's confusing is that I can't find any code that uses this table. AFAIK sqlite doesn't really check foreign keys so the whole market_id thinkg looks even more weird since we never seem to add something in this table.