restoring wallet.cpp to previous version