create sietch zaddr at beginn, and renew it after every transaction
This commit is contained in:
@@ -80,6 +80,143 @@ void Controller::setConnection(Connection* c) {
|
|||||||
// Force update, because this might be coming from a settings update
|
// Force update, because this might be coming from a settings update
|
||||||
// where we need to immediately refresh
|
// where we need to immediately refresh
|
||||||
refresh(true);
|
refresh(true);
|
||||||
|
|
||||||
|
// Create Sietch zdust addr at startup.
|
||||||
|
zrpc->createNewSietchZaddr( [=] (json reply) {
|
||||||
|
|
||||||
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch.txt");
|
||||||
|
QFile file(path);
|
||||||
|
QString zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
|
|
||||||
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
|
file.close();
|
||||||
|
} else {
|
||||||
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
zrpc->createNewSietchZaddr( [=] (json reply) {
|
||||||
|
|
||||||
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch1.txt");
|
||||||
|
QFile file(path);
|
||||||
|
QString zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
|
file.close();
|
||||||
|
} else {
|
||||||
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
zrpc->createNewSietchZaddr( [=] (json reply) {
|
||||||
|
|
||||||
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch2.txt");
|
||||||
|
QFile file(path);
|
||||||
|
auto zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
|
file.close();
|
||||||
|
} else {
|
||||||
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
zrpc->createNewSietchZaddr( [=] (json reply) {
|
||||||
|
|
||||||
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch3.txt");
|
||||||
|
QFile file(path);
|
||||||
|
QString zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
|
file.close();
|
||||||
|
} else {
|
||||||
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
zrpc->createNewSietchZaddr( [=] (json reply) {
|
||||||
|
|
||||||
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch4.txt");
|
||||||
|
QFile file(path);
|
||||||
|
auto zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
|
file.close();
|
||||||
|
} else {
|
||||||
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
zrpc->createNewSietchZaddr( [=] (json reply) {
|
||||||
|
|
||||||
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch5.txt");
|
||||||
|
QFile file(path);
|
||||||
|
QString zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
|
file.close();
|
||||||
|
} else {
|
||||||
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
zrpc->createNewSietchZaddr( [=] (json reply) {
|
||||||
|
|
||||||
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch6.txt");
|
||||||
|
QFile file(path);
|
||||||
|
auto zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
|
file.close();
|
||||||
|
} else {
|
||||||
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
zrpc->createNewSietchZaddr( [=] (json reply) {
|
||||||
|
|
||||||
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch7.txt");
|
||||||
|
QFile file(path);
|
||||||
|
QString zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
|
file.close();
|
||||||
|
} else {
|
||||||
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
zrpc->createNewSietchZaddr( [=] (json reply) {
|
||||||
|
|
||||||
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch8.txt");
|
||||||
|
QFile file(path);
|
||||||
|
auto zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
|
file.close();
|
||||||
|
} else {
|
||||||
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
zrpc->createNewSietchZaddr( [=] (json reply) {
|
||||||
|
|
||||||
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch9.txt");
|
||||||
|
QFile file(path);
|
||||||
|
auto zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
|
file.close();
|
||||||
|
} else {
|
||||||
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the RPC JSON Parameters for this tx
|
// Build the RPC JSON Parameters for this tx
|
||||||
@@ -98,31 +235,31 @@ void Controller::fillTxJsonParams(json& allRecepients, Tx tx) {
|
|||||||
json dust7 = json::object();
|
json dust7 = json::object();
|
||||||
json dust8 = json::object();
|
json dust8 = json::object();
|
||||||
json dust9 = json::object();
|
json dust9 = json::object();
|
||||||
|
// Create Sietch zdust addr again to not use it twice.
|
||||||
|
|
||||||
zrpc->createNewSietchZaddr( [=] (json reply) {
|
zrpc->createNewSietchZaddr( [=] (json reply) {
|
||||||
|
|
||||||
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch.txt");
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch.txt");
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
QString mystring = QString::fromStdString(reply.get<json::array_t>()[0]);
|
QString zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
|
|
||||||
if(!file.open(QIODevice::WriteOnly)){
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
QTextStream out(&file); out << mystring.toUtf8();
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
zrpc->createNewSietchZaddr( [=] (json reply) {
|
zrpc->createNewSietchZaddr( [=] (json reply) {
|
||||||
|
|
||||||
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch1.txt");
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch1.txt");
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
QString mystring = QString::fromStdString(reply.get<json::array_t>()[0]);
|
QString zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
if(!file.open(QIODevice::WriteOnly)){
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
QTextStream out(&file); out << mystring.toUtf8();
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,11 +268,11 @@ if(!file.open(QIODevice::WriteOnly)){
|
|||||||
|
|
||||||
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch2.txt");
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch2.txt");
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
auto mystring = QString::fromStdString(reply.get<json::array_t>()[0]);
|
auto zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
if(!file.open(QIODevice::WriteOnly)){
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
QTextStream out(&file); out << mystring.toUtf8();
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,11 +282,11 @@ if(!file.open(QIODevice::WriteOnly)){
|
|||||||
|
|
||||||
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch3.txt");
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch3.txt");
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
QString mystring = QString::fromStdString(reply.get<json::array_t>()[0]);
|
QString zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
if(!file.open(QIODevice::WriteOnly)){
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
QTextStream out(&file); out << mystring.toUtf8();
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,11 +295,11 @@ if(!file.open(QIODevice::WriteOnly)){
|
|||||||
|
|
||||||
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch4.txt");
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch4.txt");
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
auto mystring = QString::fromStdString(reply.get<json::array_t>()[0]);
|
auto zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
if(!file.open(QIODevice::WriteOnly)){
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
QTextStream out(&file); out << mystring.toUtf8();
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,11 +309,11 @@ if(!file.open(QIODevice::WriteOnly)){
|
|||||||
|
|
||||||
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch5.txt");
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch5.txt");
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
QString mystring = QString::fromStdString(reply.get<json::array_t>()[0]);
|
QString zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
if(!file.open(QIODevice::WriteOnly)){
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
QTextStream out(&file); out << mystring.toUtf8();
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,11 +322,11 @@ if(!file.open(QIODevice::WriteOnly)){
|
|||||||
|
|
||||||
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch6.txt");
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch6.txt");
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
auto mystring = QString::fromStdString(reply.get<json::array_t>()[0]);
|
auto zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
if(!file.open(QIODevice::WriteOnly)){
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
QTextStream out(&file); out << mystring.toUtf8();
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,11 +336,11 @@ if(!file.open(QIODevice::WriteOnly)){
|
|||||||
|
|
||||||
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch7.txt");
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch7.txt");
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
QString mystring = QString::fromStdString(reply.get<json::array_t>()[0]);
|
QString zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
if(!file.open(QIODevice::WriteOnly)){
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
QTextStream out(&file); out << mystring.toUtf8();
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,11 +349,11 @@ if(!file.open(QIODevice::WriteOnly)){
|
|||||||
|
|
||||||
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch8.txt");
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch8.txt");
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
auto mystring = QString::fromStdString(reply.get<json::array_t>()[0]);
|
auto zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
if(!file.open(QIODevice::WriteOnly)){
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
QTextStream out(&file); out << mystring.toUtf8();
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,18 +362,22 @@ if(!file.open(QIODevice::WriteOnly)){
|
|||||||
|
|
||||||
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch9.txt");
|
QString path= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch9.txt");
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
auto mystring = QString::fromStdString(reply.get<json::array_t>()[0]);
|
auto zdust = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
if(!file.open(QIODevice::WriteOnly)){
|
if(!file.open(QIODevice::WriteOnly)){
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
QTextStream out(&file); out << mystring.toUtf8();
|
QTextStream out(&file); out << zdust.toUtf8();
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
// Set sietch zdust addr to json.
|
||||||
|
|
||||||
QString path= (QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)) + QString("/Sietch.txt");
|
QString path= (QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)) + QString("/Sietch.txt");
|
||||||
QFile inputFile(path);
|
QFile inputFile(path);
|
||||||
|
|
||||||
|
|
||||||
if (inputFile.open(QIODevice::ReadOnly))
|
if (inputFile.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
QTextStream in(&inputFile);
|
QTextStream in(&inputFile);
|
||||||
@@ -248,18 +389,23 @@ if (inputFile.open(QIODevice::ReadOnly))
|
|||||||
inputFile.close();
|
inputFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString path1= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch1.txt");
|
QString path1= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch1.txt");
|
||||||
QFile inputFile1(path1);
|
QFile inputFile1(path1);
|
||||||
|
|
||||||
if (inputFile1.open(QIODevice::ReadOnly))
|
if (inputFile1.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
QTextStream in(&inputFile1);
|
QTextStream in(&inputFile1);
|
||||||
while (!in.atEnd())
|
while (!in.atEnd())
|
||||||
{
|
{
|
||||||
QString line = in.readLine();
|
QString line = in.readLine();
|
||||||
dust1["address"] = line.toStdString();
|
QString zdust = line;
|
||||||
|
|
||||||
|
dust1["address"] = zdust.toStdString();
|
||||||
}
|
}
|
||||||
inputFile1.close();
|
inputFile1.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString path2= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch2.txt");
|
QString path2= QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString("/Sietch2.txt");
|
||||||
QFile inputFile2(path2);
|
QFile inputFile2(path2);
|
||||||
if (inputFile2.open(QIODevice::ReadOnly))
|
if (inputFile2.open(QIODevice::ReadOnly))
|
||||||
|
|||||||
Reference in New Issue
Block a user