2019-03-17 22:52:09 +01:00
|
|
|
/*
|
|
|
|
|
* This file is part of the Flowee project
|
|
|
|
|
* Copyright (C) 2019 Tom Zander <tomz@freedommail.ch>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <QCommandLineParser>
|
|
|
|
|
#include <WorkerThreads.h>
|
2019-05-08 13:18:09 +02:00
|
|
|
#include <FloweeServiceApplication.h>
|
2019-03-17 22:52:09 +01:00
|
|
|
|
2019-05-08 13:18:09 +02:00
|
|
|
// #include <Logger.h>
|
2019-03-17 22:52:09 +01:00
|
|
|
#include <server/chainparams.h>
|
|
|
|
|
#include "TxVulcano.h"
|
|
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
|
{
|
2019-05-08 13:18:09 +02:00
|
|
|
FloweeServiceApplication app(argc, argv);
|
2019-03-17 22:52:09 +01:00
|
|
|
app.setOrganizationName("flowee");
|
|
|
|
|
app.setOrganizationDomain("flowee.org");
|
|
|
|
|
app.setApplicationName("txVulcano");
|
|
|
|
|
|
|
|
|
|
QCommandLineParser parser;
|
|
|
|
|
parser.setApplicationDescription("Transaction generator of epic proportions");
|
|
|
|
|
parser.addHelpOption();
|
2020-10-26 21:54:07 +01:00
|
|
|
QCommandLineOption sizeLimit(QStringList() << "block-size" << "b", "sets a goal to the blocks-size created (MB)", "size");
|
2019-03-17 22:52:09 +01:00
|
|
|
parser.addOption(sizeLimit);
|
2019-03-24 22:27:15 +01:00
|
|
|
QCommandLineOption txLimit(QStringList() << "num-transactions" << "n", "Limits number of transactions created (default=5000000)", "amount");
|
2019-03-18 12:36:19 +01:00
|
|
|
parser.addOption(txLimit);
|
2019-03-17 22:52:09 +01:00
|
|
|
|
2019-05-08 13:18:09 +02:00
|
|
|
app.addClientOptions(parser);
|
|
|
|
|
parser.process(app.arguments());
|
|
|
|
|
app.setup("client.log");
|
2019-03-17 22:52:09 +01:00
|
|
|
|
|
|
|
|
// Wallet needs this to work;
|
|
|
|
|
ECC_Start();
|
|
|
|
|
SelectParams("regtest");
|
2019-05-08 13:18:09 +02:00
|
|
|
|
|
|
|
|
WorkerThreads workers;
|
|
|
|
|
TxVulcano vulcano(workers.ioService());
|
2019-03-18 12:36:19 +01:00
|
|
|
if (parser.isSet(sizeLimit)) {
|
|
|
|
|
bool ok;
|
|
|
|
|
int sl = parser.value(sizeLimit).toInt(&ok);
|
|
|
|
|
if (!ok) {
|
|
|
|
|
logFatal() << "size-limit has to be a number";
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if (sl < 1) {
|
|
|
|
|
logFatal() << "Min block size is 1MB";
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
vulcano.setMaxBlockSize(sl);
|
|
|
|
|
}
|
|
|
|
|
if (parser.isSet(txLimit)) {
|
|
|
|
|
bool ok;
|
|
|
|
|
int lim = parser.value(txLimit).toInt(&ok);
|
|
|
|
|
if (!ok) {
|
|
|
|
|
logFatal() << "num-transactions has to be a number";
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if (lim < 1) {
|
|
|
|
|
logFatal() << "num-transactions to low";
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
vulcano.setMaxNumTransactions(lim);
|
|
|
|
|
}
|
2019-05-09 12:15:34 +02:00
|
|
|
vulcano.tryConnect(app.serverAddressFromArguments(11235));
|
2019-03-17 22:52:09 +01:00
|
|
|
|
2019-05-08 13:18:09 +02:00
|
|
|
return app.exec();
|
2019-03-17 22:52:09 +01:00
|
|
|
}
|