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()) {
|
if (d.exec() == QDialog::Accepted && !pui.privKeyTxt->toPlainText().trimmed().isEmpty()) {
|
||||||
auto rawkeys = pui.privKeyTxt->toPlainText().trimmed().split("\n");
|
auto rawkeys = pui.privKeyTxt->toPlainText().trimmed().split("\n");
|
||||||
|
|
||||||
auto keys = new QList<QString>();
|
QList<QString> keysTmp;
|
||||||
// Filter out all the empty keys.
|
// Filter out all the empty keys.
|
||||||
std::copy_if(rawkeys.begin(), rawkeys.end(), std::back_inserter(*keys), [=] (auto key) {
|
std::copy_if(rawkeys.begin(), rawkeys.end(), std::back_inserter(keysTmp), [=] (auto key) {
|
||||||
return !key.trimmed().isEmpty();
|
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
|
// Start the import. The function takes ownership of keys
|
||||||
doImport(keys);
|
doImport(keys);
|
||||||
QMessageBox::information(this,
|
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);
|
QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,8 +192,6 @@ void RPC::importZPrivKey(QString addr, bool rescan, const std::function<void(jso
|
|||||||
{"params", { addr.toStdString(), (rescan? "yes" : "no") }},
|
{"params", { addr.toStdString(), (rescan? "yes" : "no") }},
|
||||||
};
|
};
|
||||||
|
|
||||||
qDebug() << QString::fromStdString(payload.dump());
|
|
||||||
|
|
||||||
doSendRPC(payload, cb);
|
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") }},
|
{"params", { addr.toStdString(), (rescan? "yes" : "no") }},
|
||||||
};
|
};
|
||||||
|
|
||||||
qDebug() << QString::fromStdString(payload.dump());
|
|
||||||
doSendRPC(payload, cb);
|
doSendRPC(payload, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ void Turnstile::planMigration(QString zaddr, QString destAddr, int numsplits, in
|
|||||||
return payload;
|
return payload;
|
||||||
},
|
},
|
||||||
[=] (QMap<double, json>* newAddrs) {
|
[=] (QMap<double, json>* newAddrs) {
|
||||||
// Get block numbers
|
// Get block numbers
|
||||||
auto curBlock = Settings::getInstance()->getBlockNumber();
|
auto curBlock = Settings::getInstance()->getBlockNumber();
|
||||||
auto blockNumbers = getBlockNumbers(curBlock, curBlock + numBlocks, splits.size());
|
auto blockNumbers = getBlockNumbers(curBlock, curBlock + numBlocks, splits.size());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user