Browse Source

Start z_importwallet improvements #194

z_importwallet
Duke 11 months ago
parent
commit
2bb05486db
  1. 13
      src/wallet/rpcdump.cpp

13
src/wallet/rpcdump.cpp

@ -479,6 +479,19 @@ UniValue importwallet_impl(const UniValue& params, bool fHelp, bool fImportZKeys
EnsureWalletIsUnlocked();
struct stat s;
if( stat(params[0].get_str(),&s) == 0 ) {
if( s.st_mode & S_IFDIR ) { // it's a directory
throw JSONRPCError(RPC_WALLET_ERROR, "Invalid wallet export file");
} else if( s.st_mode & S_IFREG ) { // it's a file
// TODO: check for a min file size
} else { // something else, maybe symlink or special file
// TODO: detect difference between symlinks and special files
}
} else {
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet export file does not exist");
}
ifstream file;
file.open(params[0].get_str().c_str(), std::ios::in | std::ios::ate);
if (!file.is_open())

Loading…
Cancel
Save