Revert "Revert "Revert "Revert "Revert "Revert "Revert "Fixes to get bitcoind compiling"""""""

This reverts commit 763a899d3ed2115a60784d7cbdb7f43caf168e95.
Revert "Revert "Revert "Revert "Revert "Revert "Revert "Revert "Fixes to get bitcoind compiling""""""""

This reverts commit a866788cf49469b6a8b9070cdd4b61062c82d0b4.