Split chain database sources

This cherry-picks commit 41eb4b7eed20f5ac1da3e70f218b3f37ce2f481e from bitshares_toolkit, which allows market_engine.cpp to compile separately and resolves conflicts.  It also splits the older market_engine_v1.cpp, v2.cpp, etc. in the same manner.  This should probably be merged immediately before the next merge of bitshares_toolkit.