|
@ -252,30 +252,30 @@ void Main::addNewId(QString _ids) |
|
|
|
|
|
|
|
|
NetworkPreferences Main::netPrefs() const |
|
|
NetworkPreferences Main::netPrefs() const |
|
|
{ |
|
|
{ |
|
|
auto listenip = ui->listenIP->text().toStdString(); |
|
|
auto listenIP = ui->listenIP->text().toStdString(); |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
listenip = bi::address::from_string(listenip).to_string(); |
|
|
listenIP = bi::address::from_string(listenIP).to_string(); |
|
|
} |
|
|
} |
|
|
catch (...) |
|
|
catch (...) |
|
|
{ |
|
|
{ |
|
|
listenip = ""; |
|
|
listenIP = ""; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
auto publicip = ui->forcePublicIP->text().toStdString(); |
|
|
auto publicIP = ui->forcePublicIP->text().toStdString(); |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
publicip = bi::address::from_string(publicip).to_string(); |
|
|
publicIP = bi::address::from_string(publicIP).to_string(); |
|
|
} |
|
|
} |
|
|
catch (...) |
|
|
catch (...) |
|
|
{ |
|
|
{ |
|
|
publicip = ""; |
|
|
publicIP = ""; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (isPublicAddress(publicip)) |
|
|
if (isPublicAddress(publicIP)) |
|
|
return NetworkPreferences(publicip, ui->listenIP->text().toStdString(), ui->port->value(), ui->upnp->isChecked()); |
|
|
return NetworkPreferences(publicIP, ui->listenIP->text().toStdString(), ui->port->value(), ui->upnp->isChecked()); |
|
|
else |
|
|
else |
|
|
return NetworkPreferences(listenip, ui->port->value(), ui->upnp->isChecked()); |
|
|
return NetworkPreferences(listenIP, ui->port->value(), ui->upnp->isChecked()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Main::onKeysChanged() |
|
|
void Main::onKeysChanged() |
|
@ -1790,21 +1790,20 @@ void Main::on_connect_triggered() |
|
|
if (m_connect.exec() == QDialog::Accepted) |
|
|
if (m_connect.exec() == QDialog::Accepted) |
|
|
{ |
|
|
{ |
|
|
bool required = m_connect.required(); |
|
|
bool required = m_connect.required(); |
|
|
string host(m_connect.host().toUtf8().constData()); |
|
|
string host(m_connect.host().toStdString()); |
|
|
NodeId nodeid; |
|
|
NodeId nodeID; |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
string nstr(m_connect.nodeId().toUtf8().constData()); |
|
|
nodeID = NodeId(fromHex(m_connect.nodeId().toStdString())); |
|
|
nodeid = NodeId(fromHex(nstr)); |
|
|
|
|
|
} |
|
|
} |
|
|
catch (BadHexCharacter()) {} |
|
|
catch (BadHexCharacter()) {} |
|
|
|
|
|
|
|
|
m_connect.reset(); |
|
|
m_connect.reset(); |
|
|
|
|
|
|
|
|
if (required) |
|
|
if (required) |
|
|
web3()->requirePeer(nodeid, host); |
|
|
web3()->requirePeer(nodeID, host); |
|
|
else |
|
|
else |
|
|
web3()->addNode(nodeid, host); |
|
|
web3()->addNode(nodeID, host); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|