Decouple market dht implementation

doing the branch changing for @ArneBab (PR #639)