Adapting bitcoin.cpp to current bitcoin, more changes required to rebase completely