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

This reverts commit 9dc88e25316232f01015cfb124ceb2bb43de2672.