From 56866995f8889f28b3d08c06882bcdc8fbfa713b Mon Sep 17 00:00:00 2001 From: woodser Date: Mon, 27 May 2019 11:35:44 -0400 Subject: [PATCH] implemented setDaemonConnection() --- src/wallet/MoneroWallet.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index 77515df..dde1f24 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -47,6 +47,15 @@ void MoneroWallet::getMnemonic(epee::wipeable_string& mnemonic) const { throw runtime_error("Not implemented"); } -void MoneroWallet::setDaemonConnection(const string& daemonUri, const string& daemonUsername, const epee::wipeable_string& daemonPassword) { - throw runtime_error("Not implemented"); +void MoneroWallet::setDaemonConnection(const string& uri, const string& username, const epee::wipeable_string& password) { + + // prepare uri, login, and isTrusted for wallet2 + boost::optional login{}; + login.emplace(username, password); + bool isTrusted = false; + try { isTrusted = tools::is_local_address(uri); } // wallet is trusted iff local + catch (const exception &e) { } + + // set wallet2 daemon connection + wallet2->set_daemon(uri, login, isTrusted); }