Import from Bitcoin 0.9.3 @ 5b9f78d69ccf189bebe894b1921e34417103a046