mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 00:07:51 +00:00
Merge pull request #1015
da32161
Use wallet2_api isAddressLocal utils method for isDaemonLocal check
This commit is contained in:
commit
689123fa95
4 changed files with 10 additions and 23 deletions
12
main.qml
12
main.qml
|
@ -326,7 +326,7 @@ ApplicationWindow {
|
|||
middlePanel.transferView.updatePriorityDropdown();
|
||||
|
||||
// If wallet isnt connected and no daemon is running - Ask
|
||||
if(!isMobile && isDaemonLocal() && !walletInitialized && status === Wallet.ConnectionStatus_Disconnected && !daemonManager.running(persistentSettings.testnet)){
|
||||
if(!isMobile && walletManager.isDaemonLocal(appWindow.persistentSettings.daemon_address) && !walletInitialized && status === Wallet.ConnectionStatus_Disconnected && !daemonManager.running(persistentSettings.testnet)){
|
||||
daemonManagerDialog.open();
|
||||
}
|
||||
// initialize transaction history once wallet is initialized first time;
|
||||
|
@ -1692,16 +1692,6 @@ ApplicationWindow {
|
|||
onTriggered: checkUpdates()
|
||||
}
|
||||
|
||||
function isDaemonLocal() {
|
||||
var daemonAddress = appWindow.persistentSettings.daemon_address
|
||||
if (daemonAddress === "")
|
||||
return false
|
||||
var daemonHost = daemonAddress.split(":")[0]
|
||||
if (daemonHost === "127.0.0.1" || daemonHost === "localhost")
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
function releaseFocus() {
|
||||
// Workaround to release focus from textfield when scrolling (https://bugreports.qt.io/browse/QTBUG-34867)
|
||||
if(isAndroid) {
|
||||
|
|
|
@ -37,15 +37,6 @@ Rectangle {
|
|||
color: "#F0EEEE"
|
||||
property var currentHashRate: 0
|
||||
|
||||
function isDaemonLocal() {
|
||||
if (appWindow.currentDaemonAddress === "")
|
||||
return false
|
||||
var daemonHost = appWindow.currentDaemonAddress.split(":")[0]
|
||||
if (daemonHost === "127.0.0.1" || daemonHost === "localhost")
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
/* main layout */
|
||||
ColumnLayout {
|
||||
id: mainLayout
|
||||
|
@ -75,7 +66,7 @@ Rectangle {
|
|||
fontSize: 18
|
||||
color: "#D02020"
|
||||
text: qsTr("(only available for local daemons)")
|
||||
visible: !isDaemonLocal()
|
||||
visible: !walletManager.isDaemonLocal(appWindow.currentDaemonAddress)
|
||||
}
|
||||
|
||||
Text {
|
||||
|
@ -157,7 +148,7 @@ Rectangle {
|
|||
} else {
|
||||
errorPopup.title = qsTr("Error starting mining") + translationManager.emptyString;
|
||||
errorPopup.text = qsTr("Couldn't start mining.<br>")
|
||||
if (!isDaemonLocal())
|
||||
if (!walletManager.isDaemonLocal(appWindow.currentDaemonAddress))
|
||||
errorPopup.text += qsTr("Mining is only available on local daemons. Run a local daemon to be able to mine.<br>")
|
||||
errorPopup.icon = StandardIcon.Critical
|
||||
errorPopup.open()
|
||||
|
@ -225,7 +216,7 @@ Rectangle {
|
|||
console.log("Mining page loaded");
|
||||
|
||||
update()
|
||||
timer.running = isDaemonLocal()
|
||||
timer.running = walletManager.isDaemonLocal(appWindow.currentDaemonAddress)
|
||||
|
||||
}
|
||||
function onPageClosed() {
|
||||
|
|
|
@ -270,6 +270,11 @@ bool WalletManager::localDaemonSynced() const
|
|||
return blockchainHeight() > 1 && blockchainHeight() >= blockchainTargetHeight();
|
||||
}
|
||||
|
||||
bool WalletManager::isDaemonLocal(const QString &daemon_address) const
|
||||
{
|
||||
return Monero::Utils::isAddressLocal(daemon_address.toStdString());
|
||||
}
|
||||
|
||||
QString WalletManager::resolveOpenAlias(const QString &address) const
|
||||
{
|
||||
bool dnssec_valid = false;
|
||||
|
|
|
@ -111,6 +111,7 @@ public:
|
|||
Q_INVOKABLE quint64 blockchainTargetHeight() const;
|
||||
Q_INVOKABLE double miningHashRate() const;
|
||||
Q_INVOKABLE bool localDaemonSynced() const;
|
||||
Q_INVOKABLE bool isDaemonLocal(const QString &daemon_address) const;
|
||||
|
||||
Q_INVOKABLE bool isMining() const;
|
||||
Q_INVOKABLE bool startMining(const QString &address, quint32 threads, bool backgroundMining, bool ignoreBattery);
|
||||
|
|
Loading…
Reference in a new issue