Support importing keys from zcashd export format
This commit is contained in:
@@ -443,16 +443,21 @@ void MainWindow::importPrivKey() {
|
||||
if (d.exec() == QDialog::Accepted && !pui.privKeyTxt->toPlainText().trimmed().isEmpty()) {
|
||||
auto rawkeys = pui.privKeyTxt->toPlainText().trimmed().split("\n");
|
||||
|
||||
auto keys = new QList<QString>();
|
||||
QList<QString> keysTmp;
|
||||
// Filter out all the empty keys.
|
||||
std::copy_if(rawkeys.begin(), rawkeys.end(), std::back_inserter(*keys), [=] (auto key) {
|
||||
return !key.trimmed().isEmpty();
|
||||
std::copy_if(rawkeys.begin(), rawkeys.end(), std::back_inserter(keysTmp), [=] (auto key) {
|
||||
return !key.startsWith("#") && !key.trimmed().isEmpty();
|
||||
});
|
||||
|
||||
auto keys = new QList<QString>();
|
||||
std::transform(keysTmp.begin(), keysTmp.end(), std::back_inserter(*keys), [=](auto key) {
|
||||
return key.trimmed().split(" ")[0];
|
||||
});
|
||||
|
||||
// Start the import. The function takes ownership of keys
|
||||
doImport(keys);
|
||||
QMessageBox::information(this,
|
||||
"Imported", "The keys were imported. It may take several minutes to rescan the blockchain with the new keys for your balance to be shown accurately.",
|
||||
"Imported", "The keys were imported. It may take several minutes to rescan the blockchain. Until then, functionality may be limited",
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,8 +191,6 @@ void RPC::importZPrivKey(QString addr, bool rescan, const std::function<void(jso
|
||||
{"method", "z_importkey"},
|
||||
{"params", { addr.toStdString(), (rescan? "yes" : "no") }},
|
||||
};
|
||||
|
||||
qDebug() << QString::fromStdString(payload.dump());
|
||||
|
||||
doSendRPC(payload, cb);
|
||||
}
|
||||
@@ -206,7 +204,6 @@ void RPC::importTPrivKey(QString addr, bool rescan, const std::function<void(jso
|
||||
{"params", { addr.toStdString(), (rescan? "yes" : "no") }},
|
||||
};
|
||||
|
||||
qDebug() << QString::fromStdString(payload.dump());
|
||||
doSendRPC(payload, cb);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ void Turnstile::planMigration(QString zaddr, QString destAddr, int numsplits, in
|
||||
return payload;
|
||||
},
|
||||
[=] (QMap<double, json>* newAddrs) {
|
||||
// Get block numbers
|
||||
// Get block numbers
|
||||
auto curBlock = Settings::getInstance()->getBlockNumber();
|
||||
auto blockNumbers = getBlockNumbers(curBlock, curBlock + numBlocks, splits.size());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user