From c815bd728c10835917d3d9e6dc34d04cd0a3d5a2 Mon Sep 17 00:00:00 2001 From: woodser Date: Sat, 27 Jul 2019 15:26:35 -0400 Subject: [PATCH] rpc connection username/password are optional --- src/daemon/MoneroDaemonModel.h | 7 +++---- src/wallet/MoneroWallet.cpp | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/daemon/MoneroDaemonModel.h b/src/daemon/MoneroDaemonModel.h index 5dbac23..3c556cb 100644 --- a/src/daemon/MoneroDaemonModel.h +++ b/src/daemon/MoneroDaemonModel.h @@ -98,10 +98,9 @@ namespace monero { */ struct MoneroRpcConnection { string uri; - string username; // todo: these should be optional - string password; - //MoneroRpcConnection() : uri(""), username(""), password("")) {} - MoneroRpcConnection(const string& uri = "", const string& username = "", const string& password = "") : uri(uri), username(username), password(password) {} + boost::optional username; + boost::optional password; + MoneroRpcConnection(const string& uri = "", const boost::optional& username = boost::none, const boost::optional& password = boost::none) : uri(uri), username(username), password(password) {} }; // forward declarations diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index d20e578..c3564ff 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -878,7 +878,7 @@ namespace monero { } void MoneroWallet::setDaemonConnection(const MoneroRpcConnection& connection) { - setDaemonConnection(connection.uri, connection.username, connection.password); + setDaemonConnection(connection.uri, connection.username == boost::none ? "" : connection.username.get(), connection.password == boost::none ? "" : connection.password.get()); } shared_ptr MoneroWallet::getDaemonConnection() const {