mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
Wallet: explicitly set trusted daemon flag
This commit is contained in:
parent
0461a28701
commit
30a3abedbe
3 changed files with 22 additions and 12 deletions
16
main.qml
16
main.qml
|
@ -385,11 +385,21 @@ ApplicationWindow {
|
||||||
currentDaemonAddress = localDaemonAddress
|
currentDaemonAddress = localDaemonAddress
|
||||||
|
|
||||||
console.log("initializing with daemon address: ", currentDaemonAddress)
|
console.log("initializing with daemon address: ", currentDaemonAddress)
|
||||||
currentWallet.initAsync(currentDaemonAddress, 0, persistentSettings.is_recovering, persistentSettings.is_recovering_from_device, persistentSettings.restore_height);
|
currentWallet.initAsync(
|
||||||
|
currentDaemonAddress,
|
||||||
|
isTrustedDaemon(),
|
||||||
|
0,
|
||||||
|
persistentSettings.is_recovering,
|
||||||
|
persistentSettings.is_recovering_from_device,
|
||||||
|
persistentSettings.restore_height);
|
||||||
// save wallet keys in case wallet settings have been changed in the init
|
// save wallet keys in case wallet settings have been changed in the init
|
||||||
currentWallet.setPassword(walletPassword);
|
currentWallet.setPassword(walletPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isTrustedDaemon() {
|
||||||
|
return !persistentSettings.useRemoteNode || persistentSettings.is_trusted_daemon;
|
||||||
|
}
|
||||||
|
|
||||||
function walletPath() {
|
function walletPath() {
|
||||||
var wallet_path = persistentSettings.wallet_path
|
var wallet_path = persistentSettings.wallet_path
|
||||||
return wallet_path;
|
return wallet_path;
|
||||||
|
@ -604,7 +614,7 @@ ApplicationWindow {
|
||||||
console.log("connecting remote node");
|
console.log("connecting remote node");
|
||||||
persistentSettings.useRemoteNode = true;
|
persistentSettings.useRemoteNode = true;
|
||||||
currentDaemonAddress = persistentSettings.remoteNodeAddress;
|
currentDaemonAddress = persistentSettings.remoteNodeAddress;
|
||||||
currentWallet.initAsync(currentDaemonAddress);
|
currentWallet.initAsync(currentDaemonAddress, isTrustedDaemon());
|
||||||
walletManager.setDaemonAddressAsync(currentDaemonAddress);
|
walletManager.setDaemonAddressAsync(currentDaemonAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -615,7 +625,7 @@ ApplicationWindow {
|
||||||
console.log("disconnecting remote node");
|
console.log("disconnecting remote node");
|
||||||
persistentSettings.useRemoteNode = false;
|
persistentSettings.useRemoteNode = false;
|
||||||
currentDaemonAddress = localDaemonAddress
|
currentDaemonAddress = localDaemonAddress
|
||||||
currentWallet.initAsync(currentDaemonAddress);
|
currentWallet.initAsync(currentDaemonAddress, isTrustedDaemon());
|
||||||
walletManager.setDaemonAddressAsync(currentDaemonAddress);
|
walletManager.setDaemonAddressAsync(currentDaemonAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ bool Wallet::store(const QString &path)
|
||||||
return m_walletImpl->store(path.toStdString());
|
return m_walletImpl->store(path.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Wallet::init(const QString &daemonAddress, quint64 upperTransactionLimit, bool isRecovering, bool isRecoveringFromDevice, quint64 restoreHeight)
|
bool Wallet::init(const QString &daemonAddress, bool trustedDaemon, quint64 upperTransactionLimit, bool isRecovering, bool isRecoveringFromDevice, quint64 restoreHeight)
|
||||||
{
|
{
|
||||||
qDebug() << "init non async";
|
qDebug() << "init non async";
|
||||||
if (isRecovering){
|
if (isRecovering){
|
||||||
|
@ -221,6 +221,7 @@ bool Wallet::init(const QString &daemonAddress, quint64 upperTransactionLimit, b
|
||||||
m_walletImpl->setRefreshFromBlockHeight(restoreHeight);
|
m_walletImpl->setRefreshFromBlockHeight(restoreHeight);
|
||||||
}
|
}
|
||||||
m_walletImpl->init(daemonAddress.toStdString(), upperTransactionLimit, m_daemonUsername.toStdString(), m_daemonPassword.toStdString());
|
m_walletImpl->init(daemonAddress.toStdString(), upperTransactionLimit, m_daemonUsername.toStdString(), m_daemonPassword.toStdString());
|
||||||
|
setTrustedDaemon(trustedDaemon);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +232,7 @@ void Wallet::setDaemonLogin(const QString &daemonUsername, const QString &daemon
|
||||||
m_daemonPassword = daemonPassword;
|
m_daemonPassword = daemonPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wallet::initAsync(const QString &daemonAddress, quint64 upperTransactionLimit, bool isRecovering, bool isRecoveringFromDevice, quint64 restoreHeight)
|
void Wallet::initAsync(const QString &daemonAddress, bool trustedDaemon, quint64 upperTransactionLimit, bool isRecovering, bool isRecoveringFromDevice, quint64 restoreHeight)
|
||||||
{
|
{
|
||||||
qDebug() << "initAsync: " + daemonAddress;
|
qDebug() << "initAsync: " + daemonAddress;
|
||||||
// Change status to disconnected if connected
|
// Change status to disconnected if connected
|
||||||
|
@ -240,15 +241,14 @@ void Wallet::initAsync(const QString &daemonAddress, quint64 upperTransactionLim
|
||||||
emit connectionStatusChanged(m_connectionStatus);
|
emit connectionStatusChanged(m_connectionStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scheduler.run([this, daemonAddress, upperTransactionLimit, isRecovering, isRecoveringFromDevice, restoreHeight] {
|
m_scheduler.run([this, daemonAddress, trustedDaemon, upperTransactionLimit, isRecovering, isRecoveringFromDevice, restoreHeight] {
|
||||||
bool success = init(daemonAddress, upperTransactionLimit, isRecovering, isRecoveringFromDevice, restoreHeight);
|
bool success = init(daemonAddress, trustedDaemon, upperTransactionLimit, isRecovering, isRecoveringFromDevice, restoreHeight);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
emit walletCreationHeightChanged();
|
emit walletCreationHeightChanged();
|
||||||
qDebug() << "init async finished - starting refresh";
|
qDebug() << "init async finished - starting refresh";
|
||||||
connected(true);
|
connected(true);
|
||||||
m_walletImpl->startRefresh();
|
m_walletImpl->startRefresh();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,11 +144,8 @@ public:
|
||||||
//! empty path stores in current location
|
//! empty path stores in current location
|
||||||
Q_INVOKABLE bool store(const QString &path = "");
|
Q_INVOKABLE bool store(const QString &path = "");
|
||||||
|
|
||||||
//! initializes wallet
|
|
||||||
Q_INVOKABLE bool init(const QString &daemonAddress, quint64 upperTransactionLimit = 0, bool isRecovering = false, bool isRecoveringFromDevice = false, quint64 restoreHeight = 0);
|
|
||||||
|
|
||||||
//! initializes wallet asynchronously
|
//! initializes wallet asynchronously
|
||||||
Q_INVOKABLE void initAsync(const QString &daemonAddress, quint64 upperTransactionLimit = 0, bool isRecovering = false, bool isRecoveringFromDevice = false, quint64 restoreHeight = 0);
|
Q_INVOKABLE void initAsync(const QString &daemonAddress, bool trustedDaemon = false, quint64 upperTransactionLimit = 0, bool isRecovering = false, bool isRecoveringFromDevice = false, quint64 restoreHeight = 0);
|
||||||
|
|
||||||
// Set daemon rpc user/pass
|
// Set daemon rpc user/pass
|
||||||
Q_INVOKABLE void setDaemonLogin(const QString &daemonUsername = "", const QString &daemonPassword = "");
|
Q_INVOKABLE void setDaemonLogin(const QString &daemonUsername = "", const QString &daemonPassword = "");
|
||||||
|
@ -374,6 +371,9 @@ private:
|
||||||
//! returns daemon's blockchain target height
|
//! returns daemon's blockchain target height
|
||||||
quint64 daemonBlockChainTargetHeight() const;
|
quint64 daemonBlockChainTargetHeight() const;
|
||||||
|
|
||||||
|
//! initializes wallet
|
||||||
|
bool init(const QString &daemonAddress, bool trustedDaemon, quint64 upperTransactionLimit, bool isRecovering, bool isRecoveringFromDevice, quint64 restoreHeight);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class WalletManager;
|
friend class WalletManager;
|
||||||
friend class WalletListenerImpl;
|
friend class WalletListenerImpl;
|
||||||
|
|
Loading…
Reference in a new issue