1
mirror of https://github.com/monero-project/monero-gui synced 2024-12-22 03:15:52 +01:00

Bootstrap daemon (requires #3165)

This commit is contained in:
stoffu 2018-01-22 18:43:39 +09:00
parent af882e87f5
commit fd1f4bf628
No known key found for this signature in database
GPG Key ID: 41DAB8343A9EC012
5 changed files with 46 additions and 3 deletions

View File

@ -478,7 +478,7 @@ ApplicationWindow {
currentWallet.pauseRefresh();
appWindow.showProcessingSplash(qsTr("Waiting for daemon to start..."))
daemonManager.start(flags, persistentSettings.testnet, persistentSettings.blockchainDataDir);
daemonManager.start(flags, persistentSettings.testnet, persistentSettings.blockchainDataDir, persistentSettings.bootstrapNodeAddress);
persistentSettings.daemonFlags = flags
}
@ -1006,6 +1006,7 @@ ApplicationWindow {
property string blockchainDataDir: ""
property bool useRemoteNode: false
property string remoteNodeAddress: ""
property string bootstrapNodeAddress: ""
}
// Information dialog

View File

@ -260,6 +260,9 @@ Rectangle {
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
onClicked: {
// Update bootstrap daemon address
persistentSettings.bootstrapNodeAddress = bootstrapNodeEdit.daemonAddrText ? bootstrapNodeEdit.getAddress() : "";
// Set current daemon address to local
appWindow.currentDaemonAddress = appWindow.localDaemonAddress
appWindow.startDaemon(daemonFlags.text)
@ -374,6 +377,26 @@ Rectangle {
}
}
RowLayout {
visible: persistentSettings.startLocalNode
ColumnLayout {
Label {
color: "#4A4949"
text: qsTr("Bootstrap node (leave blank if not wanted)") + translationManager.emptyString
}
RemoteNodeEdit {
id: bootstrapNodeEdit
Layout.minimumWidth: 100 * scaleRatio
daemonAddrText: persistentSettings.bootstrapNodeAddress.split(":")[0].trim()
daemonPortText: (persistentSettings.bootstrapNodeAddress.split(":")[1].trim() == "") ? "18081" : persistentSettings.bootstrapNodeAddress.split(":")[1]
onEditingFinished: {
persistentSettings.bootstrapNodeAddress = daemonAddrText ? bootstrapNodeEdit.getAddress() : "";
console.log("setting bootstrap node to " + persistentSettings.bootstrapNodeAddress)
}
}
}
}
RowLayout {
visible: persistentSettings.useRemoteNode
ColumnLayout {

View File

@ -32,7 +32,7 @@ DaemonManager *DaemonManager::instance(const QStringList *args)
return m_instance;
}
bool DaemonManager::start(const QString &flags, bool testnet, const QString &dataDir)
bool DaemonManager::start(const QString &flags, bool testnet, const QString &dataDir, const QString &bootstrapNodeAddress)
{
// prepare command line arguments and pass to monerod
QStringList arguments;
@ -67,6 +67,11 @@ bool DaemonManager::start(const QString &flags, bool testnet, const QString &dat
arguments << dataDir;
}
// Bootstrap node address
if(!bootstrapNodeAddress.isEmpty()) {
arguments << "--bootstrap-daemon-address" << bootstrapNodeAddress;
}
arguments << "--check-updates" << "disabled";

View File

@ -14,7 +14,7 @@ public:
static DaemonManager * instance(const QStringList *args);
Q_INVOKABLE bool start(const QString &flags, bool testnet, const QString &dataDir = "");
Q_INVOKABLE bool start(const QString &flags, bool testnet, const QString &dataDir = "", const QString &bootstrapNodeAddress = "");
Q_INVOKABLE bool stop(bool testnet);
// return true if daemon process is started

View File

@ -55,6 +55,7 @@ ColumnLayout {
function onPageClosed(settingsObject) {
appWindow.persistentSettings.useRemoteNode = remoteNode.checked
appWindow.persistentSettings.remoteNodeAddress = remoteNodeEdit.getAddress();
appWindow.persistentSettings.bootstrapNodeAddress = bootstrapNodeEdit.daemonAddrText ? bootstrapNodeEdit.getAddress() : "";
return true
}
@ -165,6 +166,19 @@ ColumnLayout {
}
}
Label {
Layout.fillWidth: true
Layout.topMargin: 20 * scaleRatio
fontSize: 14 * scaleRatio
text: qsTr("Bootstrap node (leave blank if not wanted)") + translationManager.emptyString
}
RemoteNodeEdit {
Layout.minimumWidth: 300 * scaleRatio
opacity: localNode.checked
id: bootstrapNodeEdit
daemonAddrText: persistentSettings.bootstrapNodeAddress.split(":")[0].trim()
daemonPortText: (persistentSettings.bootstrapNodeAddress.split(":")[1].trim() == "") ? "18081" : persistentSettings.bootstrapNodeAddress.split(":")[1]
}
}
RowLayout {