mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 03:59:38 +00:00
Fix default daemon/remote node RPC port based on the network type
This commit is contained in:
parent
0064e595c3
commit
3aff7ddcef
3 changed files with 17 additions and 6 deletions
15
main.qml
15
main.qml
|
@ -78,7 +78,7 @@ ApplicationWindow {
|
||||||
property bool androidCloseTapped: false;
|
property bool androidCloseTapped: false;
|
||||||
property int userLastActive; // epoch
|
property int userLastActive; // epoch
|
||||||
// Default daemon addresses
|
// Default daemon addresses
|
||||||
readonly property string localDaemonAddress : persistentSettings.nettype == NetworkType.MAINNET ? "localhost:18081" : persistentSettings.nettype == NetworkType.TESTNET ? "localhost:28081" : "localhost:38081"
|
readonly property string localDaemonAddress : "localhost:" + getDefaultDaemonRpcPort(persistentSettings.nettype)
|
||||||
property string currentDaemonAddress;
|
property string currentDaemonAddress;
|
||||||
property bool startLocalNodeCancelled: false
|
property bool startLocalNodeCancelled: false
|
||||||
property int estimatedBlockchainSize: 50 // GB
|
property int estimatedBlockchainSize: 50 // GB
|
||||||
|
@ -1030,7 +1030,7 @@ ApplicationWindow {
|
||||||
property bool allow_background_mining : false
|
property bool allow_background_mining : false
|
||||||
property bool miningIgnoreBattery : true
|
property bool miningIgnoreBattery : true
|
||||||
property var nettype: NetworkType.MAINNET
|
property var nettype: NetworkType.MAINNET
|
||||||
property string daemon_address: nettype == NetworkType.TESTNET ? "localhost:28081" : nettype == NetworkType.STAGENET ? "localhost:38081" : "localhost:18081"
|
property string daemon_address: "localhost:" + getDefaultDaemonRpcPort(nettype)
|
||||||
property string payment_id
|
property string payment_id
|
||||||
property int restore_height : 0
|
property int restore_height : 0
|
||||||
property bool is_recovering : false
|
property bool is_recovering : false
|
||||||
|
@ -1891,6 +1891,17 @@ ApplicationWindow {
|
||||||
passwordDialog.open();
|
passwordDialog.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDefaultDaemonRpcPort(networkType) {
|
||||||
|
switch (networkType) {
|
||||||
|
case NetworkType.STAGENET:
|
||||||
|
return 38081;
|
||||||
|
case NetworkType.TESTNET:
|
||||||
|
return 28081;
|
||||||
|
default:
|
||||||
|
return 18081;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Daemon console
|
// Daemon console
|
||||||
DaemonConsole {
|
DaemonConsole {
|
||||||
id: daemonConsolePopup
|
id: daemonConsolePopup
|
||||||
|
|
|
@ -295,7 +295,7 @@ Rectangle{
|
||||||
|
|
||||||
property var rna: persistentSettings.remoteNodeAddress
|
property var rna: persistentSettings.remoteNodeAddress
|
||||||
daemonAddrText: rna.search(":") != -1 ? rna.split(":")[0].trim() : ""
|
daemonAddrText: rna.search(":") != -1 ? rna.split(":")[0].trim() : ""
|
||||||
daemonPortText: rna.search(":") != -1 ? (rna.split(":")[1].trim() == "") ? "18081" : rna.split(":")[1] : ""
|
daemonPortText: rna.search(":") != -1 ? (rna.split(":")[1].trim() == "") ? appWindow.getDefaultDaemonRpcPort(persistentSettings.nettype) : rna.split(":")[1] : ""
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
persistentSettings.remoteNodeAddress = remoteNodeEdit.getAddress();
|
persistentSettings.remoteNodeAddress = remoteNodeEdit.getAddress();
|
||||||
console.log("setting remote node to " + persistentSettings.remoteNodeAddress)
|
console.log("setting remote node to " + persistentSettings.remoteNodeAddress)
|
||||||
|
@ -435,7 +435,7 @@ Rectangle{
|
||||||
daemonPortText: {
|
daemonPortText: {
|
||||||
var node_split = persistentSettings.bootstrapNodeAddress.split(":");
|
var node_split = persistentSettings.bootstrapNodeAddress.split(":");
|
||||||
if(node_split.length == 2){
|
if(node_split.length == 2){
|
||||||
(node_split[1].trim() == "") ? "18081" : node_split[1];
|
(node_split[1].trim() == "") ? appWindow.getDefaultDaemonRpcPort(persistentSettings.nettype) : node_split[1];
|
||||||
} else {
|
} else {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,7 @@ ColumnLayout {
|
||||||
daemonPortText: {
|
daemonPortText: {
|
||||||
var node_split = persistentSettings.bootstrapNodeAddress.split(":");
|
var node_split = persistentSettings.bootstrapNodeAddress.split(":");
|
||||||
if(node_split.length == 2){
|
if(node_split.length == 2){
|
||||||
(node_split[1].trim() == "") ? "18081" : node_split[1];
|
(node_split[1].trim() == "") ? appWindow.getDefaultDaemonRpcPort(persistentSettings.nettype) : node_split[1];
|
||||||
} else {
|
} else {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ ColumnLayout {
|
||||||
id: remoteNodeEdit
|
id: remoteNodeEdit
|
||||||
property var rna: persistentSettings.remoteNodeAddress
|
property var rna: persistentSettings.remoteNodeAddress
|
||||||
daemonAddrText: rna.search(":") != -1 ? rna.split(":")[0].trim() : ""
|
daemonAddrText: rna.search(":") != -1 ? rna.split(":")[0].trim() : ""
|
||||||
daemonPortText: rna.search(":") != -1 ? (rna.split(":")[1].trim() == "") ? "18081" : persistentSettings.remoteNodeAddress.split(":")[1] : ""
|
daemonPortText: rna.search(":") != -1 ? (rna.split(":")[1].trim() == "") ? appWindow.getDefaultDaemonRpcPort(persistentSettings.nettype) : persistentSettings.remoteNodeAddress.split(":")[1] : ""
|
||||||
|
|
||||||
placeholderFontBold: true
|
placeholderFontBold: true
|
||||||
placeholderFontFamily: "Arial"
|
placeholderFontFamily: "Arial"
|
||||||
|
|
Loading…
Reference in a new issue