add NetworkIDString() to chainparams

- returns the BIP70 network string
- use that new function in the core and GUI code and remove unused code
  and functions
This commit is contained in:
Philip Kaufmann
2014-06-11 12:23:49 +02:00
parent 3f39b9d455
commit f5ae6c9826
8 changed files with 14 additions and 33 deletions

View File

@@ -142,14 +142,6 @@ void ClientModel::updateAlert(const QString &hash, int status)
emit alertsChanged(getStatusBarWarnings());
}
QString ClientModel::getNetworkName() const
{
QString netname(QString::fromStdString(Params().DataDir()));
if(netname.isEmpty())
netname = "main";
return netname;
}
bool ClientModel::inInitialBlockDownload() const
{
return IsInitialBlockDownload();

View File

@@ -56,8 +56,6 @@ public:
double getVerificationProgress() const;
QDateTime getLastBlockDate() const;
//! Return network (main, testnet3, regtest)
QString getNetworkName() const;
//! Return true if core is doing initial block download
bool inInitialBlockDownload() const;
//! Return true if core is importing blocks

View File

@@ -490,17 +490,6 @@ bool PaymentServer::readPaymentRequest(const QString& filename, PaymentRequestPl
return request.parse(data);
}
std::string PaymentServer::mapNetworkIdToName(CChainParams::Network networkId)
{
if (networkId == CChainParams::MAIN)
return "main";
if (networkId == CChainParams::TESTNET)
return "test";
if (networkId == CChainParams::REGTEST)
return "regtest";
return "";
}
bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, SendCoinsRecipient& recipient)
{
if (!optionsModel)
@@ -510,7 +499,7 @@ bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, SendCoins
const payments::PaymentDetails& details = request.getDetails();
// Payment request network matches client network?
if (details.network() != mapNetworkIdToName(Params().NetworkID()))
if (details.network() != Params().NetworkIDString())
{
emit message(tr("Payment request rejected"), tr("Payment request network doesn't match client network."),
CClientUIInterface::MSG_ERROR);

View File

@@ -118,7 +118,6 @@ protected:
private:
static bool readPaymentRequest(const QString& filename, PaymentRequestPlus& request);
std::string mapNetworkIdToName(CChainParams::Network networkId);
bool processPaymentRequest(PaymentRequestPlus& request, SendCoinsRecipient& recipient);
void fetchRequest(const QUrl& url);

View File

@@ -316,7 +316,7 @@ void RPCConsole::setClientModel(ClientModel *model)
ui->buildDate->setText(model->formatBuildDate());
ui->startupTime->setText(model->formatClientStartupTime());
ui->networkName->setText(model->getNetworkName());
ui->networkName->setText(QString::fromStdString(Params().NetworkIDString()));
}
}