aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2017-07-18 20:19:47 +0200
committerJonas Schnelli <dev@jonasschnelli.ch>2017-07-20 20:24:52 +0200
commit97375727b8f3b7d26c7c813630a6139005b5c5c9 (patch)
treeefca280b3bfb49f8db6d504eda0fe2349eef6110 /src
parent9e8d6a3fb43a2433ef46aaf95511650e3888f730 (diff)
[Qt] Use wallet 0 in rpc console if running with multiple wallets
Diffstat (limited to 'src')
-rw-r--r--src/qt/rpcconsole.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index ec0580b81c..232068bf45 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -25,6 +25,7 @@
#ifdef ENABLE_WALLET
#include <db_cxx.h>
+#include <wallet/wallet.h>
#endif
#include <QKeyEvent>
@@ -301,6 +302,14 @@ bool RPCConsole::RPCParseCommandLine(std::string &strResult, const std::string &
JSONRPCRequest req;
req.params = RPCConvertValues(stack.back()[0], std::vector<std::string>(stack.back().begin() + 1, stack.back().end()));
req.strMethod = stack.back()[0];
+#ifdef ENABLE_WALLET
+ // TODO: Move this logic to WalletModel
+ if (!vpwallets.empty()) {
+ // in Qt, use always the wallet with index 0 when running with multiple wallets
+ QByteArray encodedName = QUrl::toPercentEncoding(QString::fromStdString(vpwallets[0]->GetName()));
+ req.URI = "/wallet/"+std::string(encodedName.constData(), encodedName.length());
+ }
+#endif
lastResult = tableRPC.execute(req);
}