@ -1132,19 +1132,29 @@ void MainWindow::doImport(QList<QString>* keys) {
return ;
}
DEBUG ( " keys.size= " < < keys - > size ( ) ) ;
if ( keys - > isEmpty ( ) ) {
delete keys ;
ui - > statusBar - > showMessage ( tr ( " Private key import rescan finished " ) ) ;
/*
if ( rescan ) {
ui - > statusBar - > showMessage ( tr ( " Private key import with rescan finished " ) ) ;
} else {
ui - > statusBar - > showMessage ( tr ( " Private key import finished " ) ) ;
}
*/
return ;
}
// Get the first key
QString key = keys - > takeFirst ( ) ;
bool rescan = keys - > isEmpty ( ) ;
bool rescan = false ;
if ( key . startsWith ( " SK " ) | | Settings : : getInstance ( ) - > isValidSaplingPrivateKey ( key ) ) {
DEBUG ( " importing zaddr privkey with rescan= " < < rescan ) ;
rpc - > importZPrivKey ( key , rescan , [ = ] ( auto ) { this - > doImport ( keys ) ; } ) ;
} else {
DEBUG ( " importing taddr privkey with rescan= " < < rescan ) ;
rpc - > importTPrivKey ( key , rescan , [ = ] ( auto ) { this - > doImport ( keys ) ; } ) ;
}
}
@ -1280,12 +1290,33 @@ void MainWindow::importPrivKey() {
delete multiline ;
}
//TODO: if rescan is not checked, disable the rescan height input
bool rescan = pui . chkrescan - > isChecked ( ) ;
// Start the import. The function takes ownership of keys
QTimer : : singleShot ( 1 , [ = ] ( ) { doImport ( keys ) ; } ) ;
QTimer : : singleShot ( 1 , [ = ] ( ) {
// we import all keys without rescanning and then finally decide if we will rescan once
doImport ( keys ) ;
if ( rescan ) {
rpc - > rescan ( pui . rescanfrom - > text ( ) . toInt ( ) , [ = ] ( QJsonValue response ) {
qDebug ( ) < < __func__ < < " :rescanning from height " < < pui . rescanfrom < < " finished " < < response ;
ui - > statusBar - > showMessage ( tr ( " Rescanning finished " ) , 5000 ) ;
} ) ;
}
} ) ;
// Show the dialog that keys will be imported.
QMessageBox : : information ( this , " Imported " , tr ( " The keys were imported! It may take several hours to rescan the blockchain. Until then, functionality may be limited " ) ,
if ( rescan ) {
QMessageBox : : information ( this , " Imported " ,
tr ( " The keys were imported! It may take several hours to rescan the blockchain. Until then, functionality may be limited " ) ,
QMessageBox : : Ok ) ;
} else {
QMessageBox : : information ( this , " Imported " ,
tr ( " The keys were imported! You chose to not rescan, so funds in that address will not show up in your wallet yet. " ) ,
QMessageBox : : Ok ) ;
}
}
}