fix compile issue with missing min() in wallet.cpp